mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Compute v only when needed. (#95183)
This commit is contained in:
parent
23f6944c37
commit
a2fbc51198
1 changed files with 1 additions and 1 deletions
|
@ -787,7 +787,6 @@ class Random(_random.Random):
|
|||
while True:
|
||||
|
||||
u = random()
|
||||
v = random()
|
||||
u -= 0.5
|
||||
us = 0.5 - _fabs(u)
|
||||
k = _floor((2.0 * a / us + b) * u + c)
|
||||
|
@ -796,6 +795,7 @@ class Random(_random.Random):
|
|||
|
||||
# The early-out "squeeze" test substantially reduces
|
||||
# the number of acceptance condition evaluations.
|
||||
v = random()
|
||||
if us >= 0.07 and v <= vr:
|
||||
return k
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue