XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Drand48Gam_sub()

Sub Drand48Gam_sub ( Ret As  Double,
Optional Alpha As  Double = 1,
Optional Beta As  Double = 1 
)

48 bit real gamma random number (Squeeze method of Marsaglia and Tsang) (Linear congruential method) (Subroutine version)

Purpose
Generates random numbers following gamma distribution Γ(α, β).
An uniform random number is generated by the random number generator Drand48() which is based on the linear congruential method. Then it is transformed to the gamma random number by the squeeze method of Marsaglia and Tsang.
Parameters
[out]Ret48 bit real gamma random number.
If Alpha or Beta is not valid, 0 will be returned.
[in]Alpha(Optional)
The shape parameter α of the gamma distribution Γ(α, β). (α > 0) (default = 1)
[in]Beta(Optional)
The rate parameter β of the gamma distribution Γ(α, β). (β > 0) (default = 1)
Reference
(Japanese book) Yatsuji Tetsuaki, "Probability distribution random number generation method" 2nd ed., Pleiades Publishing, 2019.