blob: d508c9fa656916cef77862c41e1d4b9736e748f8 [file] [log] [blame]
Tim Peters46c04e12002-05-05 20:40:00 +00001import test_support
2import random
3
4# Ensure that the seed() method initializes all the hidden state. In
5# particular, through 2.2.1 it failed to reset a piece of state used by
6# (and only by) the .gauss() method.
7
8for seed in 1, 12, 123, 1234, 12345, 123456, 654321:
9 for seeder in random.seed, random.whseed:
10 seeder(seed)
11 x1 = random.random()
12 y1 = random.gauss(0, 1)
13
14 seeder(seed)
15 x2 = random.random()
16 y2 = random.gauss(0, 1)
17
18 test_support.vereq(x1, x2)
19 test_support.vereq(y1, y2)