From bf9cec19830acdf93bb0f5ce0a38a9f57f0db629 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 6 Dec 2016 11:27:47 -0500 Subject: [PATCH] Add the random_game() function to test.randomgen. --- test/randomgen.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/randomgen.py b/test/randomgen.py index bfc70f3..3d6484a 100644 --- a/test/randomgen.py +++ b/test/randomgen.py @@ -387,6 +387,36 @@ def random_icecream_game(): return random_icecream_game() +def random_game(): + """ + Return a random game. + + One of the functions, + + 1. :func:`random_orthant_game` + 2. :func:`random_icecream_game` + + is chosen at random and used to generate a random game. + + Returns + ------- + + SymmetricLinearGame + A random game. + + Examples + -------- + + >>> random_game() + + + """ + cone_type = randint(0,1) + if cone_type == 0: + return random_orthant_game() + elif cone_type == 1: + return random_icecream_game() + def random_ll_orthant_game(): """ Return a random Lyapunov game over some nonnegative orthant. -- 2.44.2