Skip to content

Commit 80b30cf

Browse files
author
mark.dickinson
committed
Issue #4869: clarify documentation for random.expovariate.
git-svn-id: http://svn.python.org/projects/python/trunk@68378 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 01f3994 commit 80b30cf

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Doc/library/random.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ be found in any statistics text.
210210

211211
.. function:: expovariate(lambd)
212212

213-
Exponential distribution. *lambd* is 1.0 divided by the desired mean. (The
214-
parameter would be called "lambda", but that is a reserved word in Python.)
215-
Returned values range from 0 to positive infinity.
213+
Exponential distribution. *lambd* is 1.0 divided by the desired
214+
mean. It should be nonzero. (The parameter would be called
215+
"lambda", but that is a reserved word in Python.) Returned values
216+
range from 0 to positive infinity if *lambd* is positive, and from
217+
negative infinity to 0 if *lambd* is negative.
216218

217219

218220
.. function:: gammavariate(alpha, beta)

Lib/random.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,11 @@ def lognormvariate(self, mu, sigma):
413413
def expovariate(self, lambd):
414414
"""Exponential distribution.
415415
416-
lambd is 1.0 divided by the desired mean. (The parameter would be
417-
called "lambda", but that is a reserved word in Python.) Returned
418-
values range from 0 to positive infinity.
416+
lambd is 1.0 divided by the desired mean. It should be
417+
nonzero. (The parameter would be called "lambda", but that is
418+
a reserved word in Python.) Returned values range from 0 to
419+
positive infinity if lambd is positive, and from negative
420+
infinity to 0 if lambd is negative.
419421
420422
"""
421423
# lambd: rate lambd = 1/mean

0 commit comments

Comments
 (0)