Any normally-distributed random number functions?

Van Bagnol van at group1.uucp
Fri Apr 5 04:37:39 AEST 1991


I am looking for a C or Fortran function that would generate a
pseudorandom variable but with a *normal* distribution instead
of uniform distribution. (I.e., return a random value Z with a
mean of 0 and a std. dev. of 1.)

	*	Does anyone know of any algorithm(s)?
	*	What are their pros/cons?

So far we have thought of using a "Monte Carlo" approach: take 
a sample of "n" uniformly random numbers between 0 and 1, then
get its mean and s.d. and adjust to taste. Is there a faster
and/or more elegant way? 
(BTW, how big should "n" be, 25? 30?)

Many thanks in advance.

-- 
Van Bagnol / Group One, Ltd. / (415) 398-7565 / ...!uunet!group1!van
"Be cool, have fun." / "Parang lumakad ko sa loob ang panaginip..."



More information about the Comp.lang.c mailing list