Authors: | George Marsaglia, Wai Wan Tsang | ||
Title: | The Ziggurat Method for Generating Random Variables | ||
Abstract: | We provide a new version of our ziggurat method for generating a random variable from a given decreasing density. It is faster and simpler than the original, and will produce, for example, normal or exponential variates at the rate of 15 million per second with a C version on a 400MHz PC. It uses two tables, integers ki, and reals wi. Some 99% of the time, the required x is produced by: Generate a random 32-bit integer j and let i be the index formed from the rightmost 8 bits of j. If j < k, return x = j x wi. We illustrate with C code that provides for inline generation of both normal and exponential variables, with a short procedure for settting up the necessary tables. |
||
Page views:: 57425. Submitted: 2000-04-15. Published: 2000-10-02. |
|||
Paper: |
The Ziggurat Method for Generating Random Variables
Download PDF
(Downloads: 46880)
|
||
Supplements: |
| ||
DOI: |
10.18637/jss.v005.i08
|
![]() This work is licensed under the licenses Paper: Creative Commons Attribution 3.0 Unported License Code: GNU General Public License (at least one of version 2 or version 3) or a GPL-compatible license. |