summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2017-09-04 23:51:06 (GMT)
committerGitHub <noreply@github.com>2017-09-04 23:51:06 (GMT)
commitf5ea83f4864232fecc042ff0d1c2401807b19280 (patch)
tree4d5d2e606a94afb4f18cf56a6cc40cb8f9c947d0 /Lib/random.py
parent8adc73c2c1a5e3e3c9289dd61ab553b718211b23 (diff)
downloadcpython-f5ea83f4864232fecc042ff0d1c2401807b19280.zip
cpython-f5ea83f4864232fecc042ff0d1c2401807b19280.tar.gz
cpython-f5ea83f4864232fecc042ff0d1c2401807b19280.tar.bz2
random_triangular: sqrt() is more accurate than **0.5 (#3317)
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py
index e1c2c2b..01c0c3d 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -388,7 +388,7 @@ class Random(_random.Random):
u = 1.0 - u
c = 1.0 - c
low, high = high, low
- return low + (high - low) * (u * c) ** 0.5
+ return low + (high - low) * _sqrt(u * c)
## -------------------- normal distribution --------------------