Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
random_triangular: sqrt() is more accurate than **0.5
  • Loading branch information
rhettinger committed Sep 4, 2017
commit 803702ce5f632477df7be41e7e2b67fa9b7f6bee
2 changes: 1 addition & 1 deletion Lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def triangular(self, low=0.0, high=1.0, mode=None):
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 --------------------

Expand Down