PDA_RNGAM

Returns pseudo-random numbers from a gamma distribution

Description:

This is a simple random-number generator providing deviates in the from a gamma distribution, with a period of 226, and to 6 or 7 digits accuracy. It is based upon Ahrens, Dieter & Grubes TOMS599 routines. A value of zero is returned if the argument of the gamma function is not positive.

Invocation

RESULT = PDA_RNGAM( A )

Arguments

A = REAL (Given)
The argument (mean) of the gamma function.

Returned Value

PDA_RNGAM = REAL
The pseudo-random deviate. A value of zero is returned if the argument of the gamma function is not positive.

Prior Requirements

The initial seed MUST be set using routine PDA_RNSED (equivalent to NAGs G05CBF). If it has not, there is no guarantee that sensible values will be returned from this function.

References

Ahrens, J.H., & Dieter, U. 1982, "Generating gamma variates by a modified rejection technique", Comm. ACM 25(1), pp.47–54. (For A >= 1.0, algorithm GD) Ahrens, J.H., & Dieter, U. 1974, "Computer Methods for sampling gamma, Poisson and binomial distributions", Computing. 12), pp.223–246. (For 0.0 < A < 1.0, adapted algorithm GS)