From 48998097d6c3e408e70554aadf96967af3339259 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 2 May 2026 08:00:32 -0500 Subject: [PATCH] Minor comment edit --- Lib/random.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/random.py b/Lib/random.py index dc037629bab0db..726a71e782893c 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -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