summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2006-12-20 07:43:59 (GMT)
committerRaymond Hettinger <python@rcn.com>2006-12-20 07:43:59 (GMT)
commit5425a673316af04bd1e449e45d2d9c03ee1cce25 (patch)
tree465270c497b4f83d0e2000446f9c4958849fdd61 /Lib/test/test_random.py
parente65f14fcc32bbc158d222408ec310a306714ec12 (diff)
downloadcpython-5425a673316af04bd1e449e45d2d9c03ee1cce25.zip
cpython-5425a673316af04bd1e449e45d2d9c03ee1cce25.tar.gz
cpython-5425a673316af04bd1e449e45d2d9c03ee1cce25.tar.bz2
Bug #1590891: random.randrange don't return correct value for big number
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index bba4c7c..6c32635 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -439,6 +439,14 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
self.assertEqual(k, numbits) # note the stronger assertion
self.assert_(2**k > n > 2**(k-1)) # note the stronger assertion
+ def test_randrange_bug_1590891(self):
+ start = 1000000000000
+ stop = -100000000000000000000
+ step = -200
+ x = self.gen.randrange(start, stop, step)
+ self.assert_(stop < x <= start)
+ self.assertEqual((x+stop)%step, 0)
+
_gammacoeff = (0.9999999999995183, 676.5203681218835, -1259.139216722289,
771.3234287757674, -176.6150291498386, 12.50734324009056,
-0.1385710331296526, 0.9934937113930748e-05, 0.1659470187408462e-06)