Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast random normal distribution generator [closed]

I'm currently expanding a simulation model that relies heavily upon random normal distributed numbers. Currently it uses std::normal_distribution, but it's too slow.

Is there a way to implement a fast random normal distribution? The values don't have to be unique as long as it follows a normal distribution.

like image 502
Henk Avatar asked May 08 '26 00:05

Henk


1 Answers

The Ziggurat generator by Marsaglia and Tsang (JSS, 2000) has been seen to be both statistically sound and fast. You do however want the revised Ziggurat normal generator which uses a better underlying uniform generator as per the comment of Leong et al (JSS, 2005).

I have the original papers as well as a few review papers in this GitHub directory which is part of a Ziggurat C++ implementation for R.

like image 107
Dirk Eddelbuettel Avatar answered May 10 '26 13:05

Dirk Eddelbuettel