13

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?

Robert Valencia
  • 1,752
  • 4
  • 20
  • 36
Lei_Xu
  • 155
  • 7

1 Answers1

15

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725