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.
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
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)
Library
-------
+- Bug #778964: random.seed() now uses fractional seconds so that
+ rapid successive, seeding calls will produce different sequences.
+
- Bug #777664: Add Tkconstants.HIDDEN.
- Bug #781065: test_normalization is updated to the current