diff options
-rw-r--r-- | Lib/whrandom.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/whrandom.py b/Lib/whrandom.py index 8cc1650..f43b2f9 100644 --- a/Lib/whrandom.py +++ b/Lib/whrandom.py @@ -82,7 +82,9 @@ class whrandom: return a + (b-a) * self.random() def randint(self, a, b): - """Get a random integer in the range [a, b] including both end points. + """Get a random integer in the range [a, b] including + both end points. + (Deprecated; use randrange below.)""" return self.randrange(a, b+1) @@ -91,10 +93,11 @@ class whrandom: return seq[int(self.random() * len(seq))] def randrange(self, start, stop=None, step=1, int=int, default=None): - """Choose a random item from range([start,] step[, stop]). + """Choose a random item from range(start, stop[, step]). + This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. - Do not supply the 'int' and 'default' arguments.""" + Do not supply the 'int' and 'default' arguments.""" # This code is a bit messy to make it fast for the # common case while still doing adequate error checking istart = int(start) |