Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!husc6!mit-eddie!ll-xn!nike!ucbcad!ucbvax!sdcsvax!nosc!cod!wjohnson From: wjohnson@cod.UUCP (Roger W. Johnson) Newsgroups: sci.math Subject: Re: Need formula for Normal Distribution Simulation Message-ID: <197@cod.UUCP> Date: Thu, 30-Oct-86 12:12:04 EST Article-I.D.: cod.197 Posted: Thu Oct 30 12:12:04 1986 Date-Received: Sat, 1-Nov-86 04:37:15 EST References: <146@helm.UUCP> <5270001@hpfcpf.HP.COM> Reply-To: wjohnson@cod.UUCP (Roger W. Johnson) Organization: Naval Ocean Systems Center, San Diego Lines: 37 In article <5270001@hpfcpf.HP.COM> rms@hpfcpf.HP.COM writes: >The following is called the Box-Muller algorithm, and does a very >good job of generating normal random deviates: > > 1. Generate two uniform random numbers, U1 and U2. > > 2. Let V1 = 2 * U1 - 1, and V2 = 2 * U2 - 1. > > 3. Let S = V1^2 + V2^2. > > 4. If S >= 1, go back to step 1. > > 5. Else, let T = SQRT(-2 * LN(S)/S). > > 6. Let X1 = V1 * T, and X2 = V2 * T. > >Now X1 and X2 are from a normal distribution having mean 0 and standard >deviation 1. To get mean A and standard deviation S, multiply both >by S and add A. > >Rick Scherer >Statistician >Hewlett-Packard Co. >Ft. Collins, CO The variables X1 and X2 are also independent (if U1 and U2 are independ- ent). The above "polar method for normal variates" is discussed on pg 117 of 'The Art of Computer Programming: Seminumerical Algorithms', (vol 2), 2nd ed by Donald Knuth. Other ways of generating normal variates are discussed in this text. -- Roger Johnson/Naval Ocean Systems Center/Code 421/San Diego, Ca 92152 /2150 Pacific Beach Drive/Apt 207/San Diego, Ca 92109 Reply to: wjohnson@cod.UUCP