def test_random_state_pickleable():
    r = RandomState(127)
    _ = r.randint(10)
    s = pickle.dumps(r)
    r2 = pickle.loads(s)
    assert r.get_seed() == r2.get_seed()
    assert r.generate_seed() == r2.generate_seed()
示例#2
0
def test_random_state_pickleable():
    r = RandomState(127)
    _ = r.randint(10)
    s = pickle.dumps(r)
    r2 = pickle.loads(s)
    assert r.get_seed() == r2.get_seed()
    assert r.generate_seed() == r2.generate_seed()
def test_randomstate_constructor_with_seed():
    rnd1 = RandomState(2)
    assert rnd1.get_seed() == 2
def test_randomstate_constructor_without_arg():
    rnd1 = RandomState()
    rnd2 = RandomState()
    assert rnd1.get_seed() != rnd2.get_seed()
def test_random_state_copyable():
    r = RandomState(127)
    _ = r.randint(10)
    r2 = copy(r)
    assert r.get_seed() == r2.get_seed()
    assert r.generate_seed() == r2.generate_seed()
示例#6
0
def test_randomstate_constructor_with_seed():
    rnd1 = RandomState(2)
    assert rnd1.get_seed() == 2
示例#7
0
def test_randomstate_constructor_without_arg():
    rnd1 = RandomState()
    rnd2 = RandomState()
    assert rnd1.get_seed() != rnd2.get_seed()
示例#8
0
def test_random_state_copyable():
    r = RandomState(127)
    _ = r.randint(10)
    r2 = copy(r)
    assert r.get_seed() == r2.get_seed()
    assert r.generate_seed() == r2.generate_seed()