[docs] random.gammavariate doc incomplete

Catherine Beauchemin cbeau at ryerson.ca
Wed Aug 31 22:35:04 CEST 2011


Dear maintainers,

The random.gammavariate online documentation at:

http://docs.python.org/library/random.html#random.gammavariate

is incomplete. At this page it currently states:

Gamma distribution. (Not the gamma function!) Conditions on the parameters 
are alpha > 0 and beta > 0.

whereas the docstring for version 2.7 of random.gammavariate states:

     Gamma distribution.  Not the gamma function!

     Conditions on the parameters are alpha > 0 and beta > 0.

     The probability distribution function is:

                 x ** (alpha - 1) * math.exp(-x / beta)
       pdf(x) =  --------------------------------------
                   math.gamma(alpha) * beta ** alpha


The definition of the pdf in the docstring is a must because otherwise it 
is not possible to understand what the parameters alpha and beta of the 
random.gammavariate function stand for (there are several definitions of 
the gamma distribution in common use). Generally, I would think it would 
be best to explicitly write down the pdf(x) for all random variate 
functions to make it clear what the distribution parameters stand for.

So the online documentation should be updated to match the docstring for 
random.gammavariate.

Thanks,
Catherine.


More information about the docs mailing list