def test_gaussian_random_seed(): genson.set_global_seed(42) gson = \ """ { "gaussian_random_seed" : gaussian(0, 1, draws=2) } """ gen = genson.loads(gson) vals = [val['gaussian_random_seed'] for val in gen] assert_equal(vals[0], 0.4967141530112327) assert_equal(vals[1], -0.13826430117118466) genson.set_global_seed(None) gen.reset() vals = [val['gaussian_random_seed'] for val in gen] assert_not_equal(vals[0], 0.4967141530112327) assert_not_equal(vals[1], -0.13826430117118466) genson.set_global_seed(42) gen.reset() gen = genson.loads(gson) vals = [val['gaussian_random_seed'] for val in gen] assert_equal(vals[0], 0.4967141530112327) assert_equal(vals[1], -0.13826430117118466)
def teardown_global_seed(): genson.set_global_seed(None)
def setup_global_seed(): genson.set_global_seed(None)