# [ python-Bugs-1658430 ] random.betavariate(-0,5, -0,5)

Mon Feb 12 22:45:40 CET 2007

```Bugs item #1658430, was opened at 2007-02-12 21:45
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1658430&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alain Spineux (aspineux)
Assigned to: Nobody/Anonymous (nobody)
Summary: random.betavariate(-0,5, -0,5)

Initial Comment:

betavariate(alpha, beta)
Beta distribution. Conditions on the parameters are alpha > -1 and beta > -1. Returned values range between 0 and 1.

But

>>> import random
>>> random.betavariate(-0.5, -0.5)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/random.py", line 575, in betavariate
y = self.gammavariate(alpha, 1.)
File "/usr/lib/python2.4/random.py", line 458, in gammavariate
raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
ValueError: gammavariate: alpha and beta must be > 0.0

The documentation is probably inaccurate, because they are two beta distribution usage in the math world:
one with alpha and beta >0 (the common one)
and the other whit alpha' and beta' > -1 where alpha'=alpha-1 and beta'=beta-1

this could explain the mistake.

Finally, I thing the documentation should specify :

alpha > 0 and beta > 0

The problem exist in Python 2.4.3 and probably in all versions.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1658430&group_id=5470
```