summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-09-07 15:00:15 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-09-07 15:00:15 (GMT)
commitc585eecfb0384a9c6b560477c1f04c43b55cc8e3 (patch)
treeb16d3c947ff6cf24ade3fe247100c21b71fbfd90 /Lib/random.py
parenta300007c6e047bfdd7ab8f9bef35c0929d7dbbc8 (diff)
downloadcpython-c585eecfb0384a9c6b560477c1f04c43b55cc8e3.zip
cpython-c585eecfb0384a9c6b560477c1f04c43b55cc8e3.tar.gz
cpython-c585eecfb0384a9c6b560477c1f04c43b55cc8e3.tar.bz2
Fix test that depends on a particular implementation of random.choice().
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 0886562..e0c56db 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -136,7 +136,7 @@ class Random(_random.Random):
# really unsigned 32-bit ints, so we convert negative ints from
# version 2 to positive longs for version 3.
try:
- internalstate = tuple( x % (2**32) for x in internalstate )
+ internalstate = tuple(x % (2**32) for x in internalstate)
except ValueError as e:
raise TypeError from e
super(Random, self).setstate(internalstate)
@@ -214,10 +214,7 @@ class Random(_random.Random):
def _randbelow(self, n, int=int, _maxwidth=1<<BPF, type=type,
_Method=_MethodType, _BuiltinMethod=_BuiltinMethodType):
- """Return a random int in the range [0,n)
-
- Handles the case where n has more bits than returned
- by a single call to the underlying generator.
+ """Return a random int in the range [0,n). Raises ValueError if n==0.
"""
getrandbits = self.getrandbits