Gaussian random number generators

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Antony Lewis
Posts: 1501
Joined: September 23 2004
Affiliation: University of Sussex

Gaussian random number generators

Post by Antony Lewis » December 06 2007

People my be interested to see ... cmcs07.pdf

- a comparison of various Gaussian random number generators.

I've tried the Ziggurat algorithm - which seems to be about best - using the code at

It's about 3-4 times faster than the Box-Muller rejection method (used previously my me and, I think, Healpix). For example adding uncorrelated noise to an nside=2048 polarized map goes from ~10 seconds to ~3 seconds on one processor when switching to the Ziggurat method.

One potential worry is that the period of the above code is only 2^32. Anyone know (or fancy writing) a 64-bit implementation?

giancarlo de gasperis
Posts: 2
Joined: September 25 2004
Affiliation: Dipartimento di Fisica -- Universita' di Roma "Tor Vergata"

Gaussian random number generators

Post by giancarlo de gasperis » April 23 2008


It is enough to replace the simple internal random number generator: I did that some time ago, using this generator: .
My code is on a faulty disk, If you need it I can send it to you as soon as I recover those data.



Post Reply