2 FUNCTION RGAUSS (XMEAN, SD)
3 C***BEGIN PROLOGUE RGAUSS
4 C***PURPOSE Generate a normally distributed (Gaussian) random number.
5 C***LIBRARY SLATEC (FNLIB)
7 C***TYPE SINGLE PRECISION (RGAUSS-S)
8 C***KEYWORDS FNLIB, GAUSSIAN, NORMAL, RANDOM NUMBER, SPECIAL FUNCTIONS
9 C***AUTHOR Fullerton, W., (LANL)
12 C Generate a normally distributed random number, i.e., generate random
13 C numbers with a Gaussian distribution. These random numbers are not
14 C exceptionally good -- especially in the tails of the distribution,
15 C but this implementation is simple and suitable for most applications.
16 C See R. W. Hamming, Numerical Methods for Scientists and Engineers,
17 C McGraw-Hill, 1962, pages 34 and 389.
20 C XMEAN the mean of the Guassian distribution.
21 C SD the standard deviation of the Guassian function
22 C EXP (-1/2 * (X-XMEAN)**2 / SD**2)
25 C***ROUTINES CALLED RAND
26 C***REVISION HISTORY (YYMMDD)
28 C 861211 REVISION DATE from Version 3.2
29 C 891214 Prologue converted to Version 4.0 format. (BAB)
30 C 910819 Added EXTERNAL statement for RAND due to problem on IBM
32 C***END PROLOGUE RGAUSS
34 C***FIRST EXECUTABLE STATEMENT RGAUSS
37 RGAUSS = RGAUSS + RAND(0.0)
40 RGAUSS = XMEAN + SD*RGAUSS