Change Eclipse configuration
[jabaws.git] / website / archive / binaries / mac / src / disembl / Tisean_3.0.1 / source_f / slatec / rgauss.f
1 *DECK RGAUSS
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)
6 C***CATEGORY  L6A14
7 C***TYPE      SINGLE PRECISION (RGAUSS-S)
8 C***KEYWORDS  FNLIB, GAUSSIAN, NORMAL, RANDOM NUMBER, SPECIAL FUNCTIONS
9 C***AUTHOR  Fullerton, W., (LANL)
10 C***DESCRIPTION
11 C
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.
18 C
19 C             Input Arguments --
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)
23 C
24 C***REFERENCES  (NONE)
25 C***ROUTINES CALLED  RAND
26 C***REVISION HISTORY  (YYMMDD)
27 C   770401  DATE WRITTEN
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
31 C           RS 6000.  (WRB)
32 C***END PROLOGUE  RGAUSS
33       EXTERNAL RAND
34 C***FIRST EXECUTABLE STATEMENT  RGAUSS
35       RGAUSS = -6.0
36       DO 10 I=1,12
37         RGAUSS = RGAUSS + RAND(0.0)
38  10   CONTINUE
39 C
40       RGAUSS = XMEAN + SD*RGAUSS
41 C
42       RETURN
43       END