From: Raymond Hettinger Date: Wed, 20 Dec 2006 08:23:39 +0000 (+0000) Subject: Bug #1590891: random.randrange don't return correct value for big number X-Git-Tag: v2.4.5c1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c6e470067faa954e9a0db7ae0952fbeab7c02cf;p=thirdparty%2FPython%2Fcpython.git Bug #1590891: random.randrange don't return correct value for big number --- diff --git a/Lib/random.py b/Lib/random.py index 3795b4211d8e..c86e17a736dd 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -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): diff --git a/Misc/NEWS b/Misc/NEWS index ccb37a76969c..1f36ca82f6dd 100644 --- 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).