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

◆ RanfArrGam()

Function RanfArrGam ( Optional Alpha As  Double = 1,
Optional Beta As  Double = 1 
)

53 bit real gamma random number (Squeeze method of Marsaglia and Tsang) (Lagged Fibonacci method)

Purpose
Generates random numbers following gamma distribution Γ(α, β).
An uniform random number is generated by the random number generator based on the Lagged Fibonacci method RanfArrNext(). Then it is transformed to the gamma random number by the squeeze method of Marsaglia and Tsang.
Returns
Double
53 bit real gamma random number.
If Alpha or Beta is not valid, 0 will be returned.
Parameters
[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)
Note
Same as using RanfArrNext(). See RanfArrNext() for more details.
Reference
  • D. E. Knuth, “The Art of Computer Programming Third Edition, Vol.2 / Seminumerical Algorithms”, Addison Wesley Longman, 1998.
  • Yatsuji Tetsuaki, "Probability distribution random number generation method" 2nd ed., Pleiades Publishing, 2019. (Japanese book)