IDEAS home Printed from https://ideas.repec.org/a/jss/jstsof/v005i08.html
   My bibliography  Save this article

The Ziggurat Method for Generating Random Variables

Author

Listed:
  • Marsaglia, George
  • Tsang, Wai Wan

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

Suggested Citation

  • Marsaglia, George & Tsang, Wai Wan, 2000. "The Ziggurat Method for Generating Random Variables," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 5(i08).
  • Handle: RePEc:jss:jstsof:v:005:i08
    DOI: http://hdl.handle.net/10.18637/jss.v005.i08
    as

    Download full text from publisher

    File URL: https://www.jstatsoft.org/index.php/jss/article/view/v005i08/ziggurat.pdf
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v005i08/rnorrexp.c
    Download Restriction: no

    File URL: https://libkey.io/http://hdl.handle.net/10.18637/jss.v005.i08?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Parrini, Alessandro, 2013. "Importance Sampling for Portfolio Credit Risk in Factor Copula Models," MPRA Paper 103745, University Library of Munich, Germany.
    2. Nordahl, Helge A., 2008. "Valuation of life insurance surrender and exchange options," Insurance: Mathematics and Economics, Elsevier, vol. 42(3), pages 909-919, June.
    3. Kurita, Takamitsu, 2020. "Likelihood-based tests for parameter constancy in I(2) CVAR models with an application to fixed-term deposit data," Journal of Multivariate Analysis, Elsevier, vol. 178(C).
    4. Ran Li & Xiaomeng Duan & Yongfeng Lv, 2018. "Adaptive compressive sensing of images using error between blocks," International Journal of Distributed Sensor Networks, , vol. 14(6), pages 15501477187, June.
    5. Allin Cottrell, 2021. "Response surfaces for DF-GLS p-values," gretl working papers 8, Universita' Politecnica delle Marche (I), Dipartimento di Scienze Economiche e Sociali.
    6. Diaz-Emparanza, Ignacio, 2014. "Numerical distribution functions for seasonal unit root tests," Computational Statistics & Data Analysis, Elsevier, vol. 76(C), pages 237-247.
    7. Michele Azzone & Roberto Baviera, 2023. "A fast Monte Carlo scheme for additive processes and option pricing," Computational Management Science, Springer, vol. 20(1), pages 1-34, December.
    8. Roberto Baviera & Pietro Manzoni, 2024. "Fast and General Simulation of L\'evy-driven OU processes for Energy Derivatives," Papers 2401.15483, arXiv.org, revised Sep 2024.
    9. Björn Lutz, 2010. "Pricing of Derivatives on Mean-Reverting Assets," Lecture Notes in Economics and Mathematical Systems, Springer, number 978-3-642-02909-7, July.
    10. Biswa Sengupta & Simon Barry Laughlin & Jeremy Edward Niven, 2014. "Consequences of Converting Graded to Action Potentials upon Neural Information Coding and Energy Efficiency," PLOS Computational Biology, Public Library of Science, vol. 10(1), pages 1-18, January.
    11. Yiran Chen & Giray Ökten, 2022. "A goodness-of-fit test for copulas based on the collision test," Statistical Papers, Springer, vol. 63(5), pages 1369-1385, October.
    12. Emma Viviani & Luca Di Persio & Matthias Ehrhardt, 2021. "Energy Markets Forecasting. From Inferential Statistics to Machine Learning: The German Case," Energies, MDPI, vol. 14(2), pages 1-33, January.
    13. Rui Zhang & Lawrence M. Leemis, 2012. "Rectangles algorithm for generating normal variates," Naval Research Logistics (NRL), John Wiley & Sons, vol. 59(1), pages 52-57, February.
    14. Ahmed Bensaida, 2012. "Improving the Forecasting Power of Volatility Models," International Journal of Academic Research in Accounting, Finance and Management Sciences, Human Resource Management Academic Research Society, International Journal of Academic Research in Accounting, Finance and Management Sciences, vol. 2(3), pages 51-64, July.
    15. Hime Aguiar e Oliveira, 2022. "Deterministic sampling from uniform distributions with Sierpiński space-filling curves," Computational Statistics, Springer, vol. 37(1), pages 535-549, March.
    16. Nguyen Nguyet & Xu Linlin & Ökten Giray, 2018. "A quasi-Monte Carlo implementation of the ziggurat method," Monte Carlo Methods and Applications, De Gruyter, vol. 24(2), pages 93-99, June.
    17. Michele Azzone & Roberto Baviera, 2021. "A fast Monte Carlo scheme for additive processes and option pricing," Papers 2112.08291, arXiv.org, revised Jul 2023.
    18. repec:jss:jstsof:12:i07 is not listed on IDEAS
    19. Leong, Philip H. W. & Zhang, Ganglie & Lee, Dong-U & Luk, Wayne & Villasenor, John, 2005. "A Comment on the Implementation of the Ziggurat Method," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 12(i07).
    20. Ömür Ugur, 2008. "An Introduction to Computational Finance," World Scientific Books, World Scientific Publishing Co. Pte. Ltd., number p556, February.
    21. Yalta, A. Talha & Schreiber, Sven, 2012. "Random Number Generation in gretl," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 50(c01).
    22. Thomas W. Zuehlke, 2017. "Use of quadratic terms in Type 2 Tobit models," Applied Economics, Taylor & Francis Journals, vol. 49(17), pages 1706-1714, April.
    23. Huthmacher, Klaus & Herzwurm, André & Gnewuch, Michael & Ritter, Klaus & Rethfeld, Baerbel, 2015. "Monte Carlo simulation of electron dynamics in liquid water," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 429(C), pages 242-251.
    24. Harman, Radoslav & Lacko, Vladimír, 2010. "On decompositional algorithms for uniform sampling from n-spheres and n-balls," Journal of Multivariate Analysis, Elsevier, vol. 101(10), pages 2297-2304, November.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:jss:jstsof:v:005:i08. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum (email available below). General contact details of provider: http://www.jstatsoft.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.