van@group1.uucp (Van Bagnol) (04/05/91)
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..."
gwyn@smoke.brl.mil (Doug Gwyn) (04/05/91)
In article <1991Apr04.183739.4876@group1.UUCP> van@group1.uucp (Van Bagnol) writes: >I am looking for a C or Fortran function that would generate a >pseudorandom variable but with a *normal* distribution instead >of uniform distribution. Gee, for all questions of this type the first thing you MUST do is to see what Knuth had to say about it in Vol. 2 of The Art of Computer Programming.