From 7c6e470067faa954e9a0db7ae0952fbeab7c02cf Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 20 Dec 2006 08:23:39 +0000 Subject: Bug #1590891: random.randrange don't return correct value for big number --- Lib/random.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/random.py b/Lib/random.py index 3795b42..c86e17a 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 ccb37a7..1f36ca8 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). -- cgit v0.12