Both the documentation at http://docs.python.org/lib/module-random.html and the docstring have the same erroneous input conditions. They claim input must be >-1 when it must in fact be >0.
Note also the freak "}" that has snuck into the docstring (copied and pasted from the documentation perhaps?).
>>> import random
>>> print random.betavariate.__doc__
Beta distribution.
Conditions on the parameters are alpha > -1 and beta} > -1.
Returned values range between 0 and 1.
>>> random.betavariate(0, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/random.py", line 594, in betavariate
y = self.gammavariate(alpha, 1.)
File "/usr/lib/python2.3/random.py", line 457, in gammavariate
raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
ValueError: gammavariate: alpha and beta must be > 0.0
|