diff options
author | Guido van Rossum <guido@python.org> | 1996-10-21 23:20:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-10-21 23:20:03 (GMT) |
commit | 9cb018e693bde93ef8c19142299b39ed273f157e (patch) | |
tree | d25cd7f2fd3139eb889d1144a1c5713ae378cc76 /Lib/whrandom.py | |
parent | b6685dcfeb44fe3ca4792bc603648fa88e07c43d (diff) | |
download | cpython-9cb018e693bde93ef8c19142299b39ed273f157e.zip cpython-9cb018e693bde93ef8c19142299b39ed273f157e.tar.gz cpython-9cb018e693bde93ef8c19142299b39ed273f157e.tar.bz2 |
Change the default seeding -- use 8 bits of sub-second precision and
fold in the higest 8 bits of the time as well.
Diffstat (limited to 'Lib/whrandom.py')
-rw-r--r-- | Lib/whrandom.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/whrandom.py b/Lib/whrandom.py index 8ed39c9..3cc1532 100644 --- a/Lib/whrandom.py +++ b/Lib/whrandom.py @@ -49,7 +49,8 @@ class whrandom: if 0 == x == y == z: # Initialize from current time import time - t = int(time.time() % 0x80000000) + t = long(time.time() * 256) + t = int((t&0xffffff) | (t>>24)) t, x = divmod(t, 256) t, y = divmod(t, 256) t, z = divmod(t, 256) |