From: Mark Dickinson Date: Wed, 7 Jan 2009 17:48:33 +0000 (+0000) Subject: Issue #4869: clarify documentation for random.expovariate. X-Git-Tag: v2.7a1~2368 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6dc53120d52f58057fd1a6d666d21cb9d71c08d;p=thirdparty%2FPython%2Fcpython.git Issue #4869: clarify documentation for random.expovariate. --- diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 858888c9c557..63c4bc71a5c9 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -210,9 +210,11 @@ be found in any statistics text. .. function:: expovariate(lambd) - Exponential distribution. *lambd* is 1.0 divided by the desired mean. (The - parameter would be called "lambda", but that is a reserved word in Python.) - Returned values range from 0 to positive infinity. + Exponential distribution. *lambd* is 1.0 divided by the desired + mean. It should be nonzero. (The parameter would be called + "lambda", but that is a reserved word in Python.) Returned values + range from 0 to positive infinity if *lambd* is positive, and from + negative infinity to 0 if *lambd* is negative. .. function:: gammavariate(alpha, beta) diff --git a/Lib/random.py b/Lib/random.py index 5879340a8d46..8b4c38edb176 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -413,9 +413,11 @@ class Random(_random.Random): def expovariate(self, lambd): """Exponential distribution. - lambd is 1.0 divided by the desired mean. (The parameter would be - called "lambda", but that is a reserved word in Python.) Returned - values range from 0 to positive infinity. + lambd is 1.0 divided by the desired mean. It should be + nonzero. (The parameter would be called "lambda", but that is + a reserved word in Python.) Returned values range from 0 to + positive infinity if lambd is positive, and from negative + infinity to 0 if lambd is negative. """ # lambd: rate lambd = 1/mean