Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5ea83f

Browse files
authored
random_triangular: sqrt() is more accurate than **0.5 (#3317)
1 parent 8adc73c commit f5ea83f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def triangular(self, low=0.0, high=1.0, mode=None):
388388
u = 1.0 - u
389389
c = 1.0 - c
390390
low, high = high, low
391-
return low + (high - low) * (u * c) ** 0.5
391+
return low + (high - low) * _sqrt(u * c)
392392

393393
## -------------------- normal distribution --------------------
394394

0 commit comments

Comments
 (0)