Random randomness

W. Jarrett Campbell jarrett at engineer.com
Wed Jan 23 17:39:05 EST 2002


I'm working on a project that requires a random number generated with the
same value each time the program is run but I'm seeing some behavior I
cannot explain.  Could someone explain to me why the following code does not
result in two random numbers where a = b?

FYI, I'm running Python 2.1 on win32s...

C:\>python
ActivePython 2.1, build 210 ActiveState)
based on Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>>
>>> random.seed(10)
>>> a=random.gauss(0,1)
>>> random.seed(10)
>>> b=random.gauss(0,1)
>>> print a
1.14050714147
>>> print b
0.566965824829


Thanks in advance,

Jarrett Campbell
jarrett at engineer.com





More information about the Python-list mailing list