What is the algorithm used by the normally distributed pseudorandom number generator RANDN in MATLAB 5.0 and later?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 13 Dez. 2012
Bearbeitet: MathWorks Support Team
am 19 Apr. 2023
I am generating random numbers with RANDN and I would like to know the algorithm used and its period.
Akzeptierte Antwort
MathWorks Support Team
am 18 Apr. 2023
Bearbeitet: MathWorks Support Team
am 19 Apr. 2023
This change has been incorporated into the documentation in Release 2009a (R2009a). For previous releases, read below for any additional information:
The default normal random number generator algorithm used in RANDN in MATLAB 5.0 (R12) and later is an implementation of the Ziggurat method of Marsaglia and Tsang. The implementation has a period on the order of 2^64.
One implementation (not the one used in MATLAB) of the Ziggurat method in the literature has a period of 2^32-1, and a paper by Leong et al.
(Journal of Statistical Software 12(7)) commented that this period is probably too short for current use. As noted above, the implementation of the Ziggurat method used in RANDN has a much longer period.
Details of the Ziggurat method are discussed in chapter 9 of the book Numerical Computing with MATLAB. The book is available on-line at
and a PDF-file for chapter 9 is at
Prior to MATLAB Version 5, RANDN used an implementation of the Polar method. The implementation has a period of approximately (2^32-1)*(pi/8). Type "doc RANDN" at the MATLAB command prompt for details on how to use that algorithm.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multivariate Normal Distribution finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!