Generates a pseudorandom number from a standard gamma distribution.
double
which specifies the shape parameter of the gamma distribution. It must be positive. A double
which specifies a pseudorandom number from a standard gamma distribution.
Method NextGamma
generates pseudorandom numbers from a gamma distribution with shape parameter a. The probability density function is
Various computational algorithms are used depending on the value of the shape parameter a. For the special case of a = 0.5, squared and halved normal deviates are used; and for the special case of a = 1.0, exponential deviates (from method NextExponential
) are used. Otherwise, if a is less than 1.0, an acceptance-rejection method due to Ahrens, described in Ahrens and Dieter (1974), is used; if a is greater than 1.0, a ten-region rejection procedure developed by Schmeiser and Lal (1980) is used.
The Erlang distribution is a standard gamma distribution with the shape parameter having a value equal to a positive integer; hence, NextGamma
generates pseudorandom deviates from an Erlang distribution with no modifications required.
Random Class | Imsl.Stat Namespace | Example