[Python-checkins] python/dist/src/Lib random.py,1.51,1.51.8.1
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sat Aug 9 12:20:18 EDT 2003
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv20698/Lib
Modified Files:
Tag: release23-maint
random.py
Log Message:
SF bug #778964: bad seed in python 2.3 random
The default seed is time.time().
Multiplied by 256 before truncating so that fractional seconds are used.
This way, two consequetive calls to random.seed() are much more likely
to produce different sequences.
Index: random.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v
retrieving revision 1.51
retrieving revision 1.51.8.1
diff -C2 -d -r1.51 -r1.51.8.1
*** random.py 24 Jun 2003 20:29:04 -0000 1.51
--- random.py 9 Aug 2003 18:20:16 -0000 1.51.8.1
***************
*** 95,98 ****
--- 95,101 ----
"""
+ if a is None:
+ import time
+ a = long(time.time() * 256) # use fractional seconds
super(Random, self).seed(a)
self.gauss_next = None
More information about the Python-checkins
mailing list