Bug in the standard module random ?
Weet Vanniks
No at Spam.Please
Thu Mar 7 11:13:38 EST 2002
Hi,
The gammavariate function of the standard module is documented as
taking two parameters, the first one alpha is required to be > -1 and
the second beta is required to be >0.
However, examining the implementation, it seems that the requirement for
alpha is to be >0.
In spite of this, I still have a problem since I called the gammavariate
function with a parameter alpha equal to 0.2 and it fails logically on
the following line:
ainv=_sqrt(2.0 * alpha - 1.0)
Apparently, the implementation requires alpha to be > 0.5.
Am i missing something or is it a bug?
Best regards
Weet
## -------------------- gamma distribution --------------------
def gammavariate(self, alpha, beta):
# beta times standard gamma
ainv = _sqrt(2.0 * alpha - 1.0)
return beta * self.stdgamma(alpha, ainv, alpha - LOG4, alpha +
ainv)
More information about the Python-list
mailing list