Closes #14591: Random.jumpahead could produce an invalid MT state on 64-bit machines.
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 @@
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