From f5ea83f4864232fecc042ff0d1c2401807b19280 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Mon, 4 Sep 2017 16:51:06 -0700 Subject: random_triangular: sqrt() is more accurate than **0.5 (#3317) --- Lib/random.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -------------------- -- cgit v0.12