blob: 5f60f4b7b23521ef3ec08fbb618dc86fb0957740 [file] [log] [blame]
Barry Warsaw04f357c2002-07-23 19:04:11 +00001from test import test_support
Tim Peters46c04e12002-05-05 20:40:00 +00002import 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)