diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/random.py | 3 | ||||
-rw-r--r-- | Lib/test/test_random.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py index 76dc416..7932ac7 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -94,6 +94,9 @@ class Random(_random.Random): If a is not None or an int or long, hash(a) is used instead. """ + if a is None: + import time + a = long(time.time() * 256) # use fractional seconds super(Random, self).seed(a) self.gauss_next = None diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index ea2243d..c9103e8 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -20,7 +20,7 @@ class TestBasicOps(unittest.TestCase): def test_autoseed(self): self.gen.seed() state1 = self.gen.getstate() - time.sleep(1.1) + time.sleep(0.1) self.gen.seed() # diffent seeds at different times state2 = self.gen.getstate() self.assertNotEqual(state1, state2) |