Normal distribution random number generator -- WANTED

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Sun Dec 2 08:58:40 AEST 1990


In article <wilf.660026793 at rigel.sce.carleton.ca> wilf at sce.carleton.ca (Wilf Leblanc) writes:
> >I am looking for C source code to generate normal distribution
> >random numbers.
> Add M random uniform random numbers x (where x is between 0 and
> N/M).  Using M = 12 to 30, will generate random variables which
> are very close to normal,

There are many methods available which are not only accurate but also a
lot faster than generating and summing thirty numbers. (It's also very
dangerous to add successive outputs of a linear congruential sequence.)
Look in Knuth chapter 3 to find some good techniques.

---Dan



More information about the Comp.lang.c mailing list