diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-07-23 23:07:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-23 23:07:17 (GMT) |
commit | a2fbc511985f77c16c0f4a6fc6d3da9ab81a86b7 (patch) | |
tree | 8f4cd2315cf2081c1a3b5e520d1204631fdc0419 /Lib/random.py | |
parent | 23f6944c37e0d57c1e065d5f71a4cd0f5f5b3111 (diff) | |
download | cpython-a2fbc511985f77c16c0f4a6fc6d3da9ab81a86b7.zip cpython-a2fbc511985f77c16c0f4a6fc6d3da9ab81a86b7.tar.gz cpython-a2fbc511985f77c16c0f4a6fc6d3da9ab81a86b7.tar.bz2 |
Compute v only when needed. (#95183)
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py index 00849bd..ef0034a 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -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 |