Returns pseudo-random numbers from a gamma distribution

This is a
simple random-number generator providing deviates in the from a gamma distribution, with a period of
2$\ast $$\ast $26,
and to 6 or 7 digits accuracy. It is based upon Ahrens, Dieter & Grube

`’`

s TOMS599 routines. A value of
zero is returned if the argument of the gamma function is not positive. RESULT =
PDA_RNGAM( A )

The argument (mean) of the gamma function.

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

The initial seed MUST be
set using routine PDA_RNSED (equivalent to NAG

`’`

s G05CBF). If it has not, there is no guarantee that
sensible values will be returned from this function. 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)