예제 #1
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()
예제 #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()
예제 #3
0
def test_randomstate_constructor_with_seed():
    rnd1 = RandomState(2)
    assert rnd1.get_seed() == 2
예제 #4
0
def test_randomstate_constructor_without_arg():
    rnd1 = RandomState()
    rnd2 = RandomState()
    assert rnd1.get_seed() != rnd2.get_seed()
예제 #5
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()
예제 #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 rnd():
    return RandomState(1)
예제 #9
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()