]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1590891: random.randrange don't return correct value for big number
authorRaymond Hettinger <python@rcn.com>
Wed, 20 Dec 2006 08:23:39 +0000 (08:23 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 20 Dec 2006 08:23:39 +0000 (08:23 +0000)
Lib/random.py
Misc/NEWS

index 3795b4211d8e0584c60191f4df9bb95f0e93f94c..c86e17a736dd3b085a535f65748c523b5d92558a 100644 (file)
@@ -205,7 +205,7 @@ class Random(_random.Random):
             raise ValueError, "empty range for randrange()"
 
         if n >= maxwidth:
-            return istart + self._randbelow(n)
+            return istart + istep*self._randbelow(n)
         return istart + istep*int(self.random() * n)
 
     def randint(self, a, b):
index ccb37a76969ca911fa7ca906cb7f1fb07111c065..1f36ca82f6dda820f90c140a69a46ce8347cac3f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,8 @@ What's New in Python 2.4.5c1?
 Core and builtins
 -----------------
 
+- Bug #1590891: random.randrange don't return correct value for big number
+
 - Bug #1542016: make sys.callstats() match its docstring and return an
   11-tuple (only relevant when Python is compiled with -DCALL_PROFILE).