X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2Frandomgen.py;h=eb6ea580e51dd9a0313b9c7a3106e3ee76678b93;hb=687129a369e51b90c1c46152027981813aedbe0d;hp=bfc70f3cf320031f6c8b7047ebdf9746288c0882;hpb=0274de467062ab29d2a41d2a91ec0b28fcd95c8d;p=dunshire.git diff --git a/test/randomgen.py b/test/randomgen.py index bfc70f3..eb6ea58 100644 --- a/test/randomgen.py +++ b/test/randomgen.py @@ -387,6 +387,37 @@ 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. @@ -469,6 +500,37 @@ def random_ll_icecream_game(): return G +def random_ll_game(): + """ + Return a random Lyapunov-like game. + + One of the functions, + + 1. :func:`random_ll_orthant_game` + 2. :func:`random_ll_icecream_game` + + is chosen at random and used to generate a random game. + + Returns + ------- + + SymmetricLinearGame + A random Lyapunov-like game. + + Examples + -------- + + >>> random_ll_game() + + + """ + cone_type = randint(0,1) + if cone_type == 0: + return random_ll_orthant_game() + elif cone_type == 1: + return random_ll_icecream_game() + + def random_positive_orthant_game(): """ Return a random game over the nonnegative orthant with a positive