简体   繁体   中英

How to generate random numbers faster in R?

My project requires generating a substantial amount (in the order of 10^7, for example) of random numbers that is normally distributed, and this step takes a significant amount of computational resources.

Is there a more efficient method than rnorm for generating such data?

Yes, you can use the Ziggurat method via RcppZiggurat . This is one of the faster/fastest algorithm for standard normally distributed random numbers.

The pdf vignette has timing comparison charts; there is also one on package page on my server .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM