diff options
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/random.py b/Lib/random.py index 91065b7..0bc2417 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -242,6 +242,8 @@ class Random(_random.Random): "enough bits to choose from a population range this large.\n" "To remove the range limitation, add a getrandbits() method.") return int(random() * n) + if n == 0: + raise ValueError("Boundary cannot be zero") rem = maxsize % n limit = (maxsize - rem) / maxsize # int(limit * maxsize) % n == 0 r = random() |