Commit f5ea83f4 authored by Raymond Hettinger's avatar Raymond Hettinger Committed by GitHub

random_triangular: sqrt() is more accurate than **0.5 (#3317)

parent 8adc73c2
......@@ -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 --------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment