This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect documentation for random.betavariate()
Type: Stage:
Components: Documentation Versions: Python 2.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: loewis, rhettinger, troels
Priority: normal Keywords:

Created on 2007-01-18 14:18 by troels, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31069 - (view) Author: Troels Walsted Hansen (troels) Date: 2007-01-18 14:18
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
msg31070 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-01-18 20:03
This seems to be a duplicate of 1635892
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44488
2007-01-18 14:18:10troelscreate