Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,8 @@ def binomialvariate(self, n=1, p=0.5):
while True:
try:
y += _floor(_log2(random()) / c) + 1
# The random() function can return 0.0, which causes log2(0.0) to raise a ValueError.
# See https://github.com/python/cpython/issue/149221
except ValueError:
# Reject case where random() returned 0.0
continue
if y > n:
return x
Expand Down
Loading