Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!sri-unix!hplabs!hpcea!hpfcdc!hpfcpf!rms From: rms@hpfcpf.HP.COM Newsgroups: sci.math Subject: Re: Need formula for Normal Distribution Simulation Message-ID: <5270001@hpfcpf.HP.COM> Date: Tue, 28-Oct-86 11:00:27 EST Article-I.D.: hpfcpf.5270001 Posted: Tue Oct 28 11:00:27 1986 Date-Received: Wed, 29-Oct-86 22:40:15 EST References: <146@helm.UUCP> Organization: Hewlett-Packard Lines: 23 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