Skip to content

Commit 950bd59

Browse files
committed
Test seed reset
1 parent 542576b commit 950bd59

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/zrandom_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,21 @@ def test_get_predictable_random():
2424
for i in range(1000):
2525
pass2.append(rand.get_random(100))
2626
assert pass1 == pass2
27+
28+
29+
def test_get_predictable_random_then_random():
30+
container = Container()
31+
rand = cast(ZRandom, container.resolve("ZRandom"))
32+
rand.set_seed(42)
33+
pass1 = []
34+
for i in range(1000):
35+
pass1.append(rand.get_random(100))
36+
rand.set_seed(0)
37+
pass2 = []
38+
for i in range(1000):
39+
pass2.append(rand.get_random(100))
40+
assert pass1 != pass2
41+
pass3 = []
42+
for i in range(1000):
43+
pass3.append(rand.get_random(100))
44+
assert pass2 != pass3

0 commit comments

Comments
 (0)