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

This commit is contained in:
Raymond Hettinger 2017-09-04 16:51:06 -07:00 committed by GitHub
parent 8adc73c2c1
commit f5ea83f486
1 changed files with 1 additions and 1 deletions

View File

@ -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 --------------------