mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Fix test that depends on a particular implementation of random.choice().
This commit is contained in:
parent
a300007c6e
commit
c585eecfb0
2 changed files with 24 additions and 27 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue