diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-06-30 16:19:35 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-06-30 16:19:35 (GMT) |
commit | e0afb724020313d1d7ed0edf0662925bb74d995f (patch) | |
tree | 6193c1427ad4e8ffe311b56dafa864b680384550 /Lib/test/test_random.py | |
parent | 9848d812a386fd91536cdc252185ebae20e267c7 (diff) | |
download | cpython-e0afb724020313d1d7ed0edf0662925bb74d995f.zip cpython-e0afb724020313d1d7ed0edf0662925bb74d995f.tar.gz cpython-e0afb724020313d1d7ed0edf0662925bb74d995f.tar.bz2 |
Closes #14591: Random.jumpahead could produce an invalid MT state on 64-bit machines.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r-- | Lib/test/test_random.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index df82990..caa4f28 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -57,6 +57,14 @@ class TestBasicOps(unittest.TestCase): self.assertRaises(TypeError, self.gen.jumpahead) # needs an arg self.assertRaises(TypeError, self.gen.jumpahead, 2, 3) # too many + def test_jumpahead_produces_valid_state(self): + # From http://bugs.python.org/issue14591. + self.gen.seed(199210368) + self.gen.jumpahead(13550674232554645900) + for i in range(500): + val = self.gen.random() + self.assertLess(val, 1.0) + def test_sample(self): # For the entire allowable range of 0 <= k <= N, validate that # the sample is of the correct length and contains only unique items |