diff options
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/random.py b/Lib/random.py index 72822f2..af788c6 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -445,14 +445,14 @@ class Random: ## -------------------- gamma distribution -------------------- def gammavariate(self, alpha, beta): - + # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 - + # Warning: a few older sources define the gamma distribution in terms # of alpha > -1.0 if alpha <= 0.0 or beta <= 0.0: raise ValueError, 'gammavariate: alpha and beta must be > 0.0' - + random = self.random if alpha > 1.0: @@ -463,7 +463,7 @@ class Random: ainv = _sqrt(2.0 * alpha - 1.0) bbb = alpha - LOG4 ccc = alpha + ainv - + while 1: u1 = random() u2 = random() @@ -630,7 +630,7 @@ def _test(N=20000): _test_generator(N, 'vonmisesvariate(0.0, 1.0)') _test_generator(N, 'gammavariate(0.01, 1.0)') _test_generator(N, 'gammavariate(0.1, 1.0)') - _test_generator(N, 'gammavariate(0.1, 2.0)') + _test_generator(N, 'gammavariate(0.1, 2.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') _test_generator(N, 'gammavariate(1.0, 1.0)') |