gennor.f

Go to the documentation of this file.
00001       REAL FUNCTION gennor(av,sd)
00002 C**********************************************************************
00003 C
00004 C     REAL FUNCTION GENNOR( AV, SD )
00005 C
00006 C         GENerate random deviate from a NORmal distribution
00007 C
00008 C
00009 C                              Function
00010 C
00011 C
00012 C     Generates a single random deviate from a normal distribution
00013 C     with mean, AV, and standard deviation, SD.
00014 C
00015 C
00016 C                              Arguments
00017 C
00018 C
00019 C     AV --> Mean of the normal distribution.
00020 C                              REAL AV
00021 C
00022 C     SD --> Standard deviation of the normal distribution.
00023 C                              REAL SD
00024 C     JJV                      (SD >= 0)
00025 C
00026 C     GENNOR <-- Generated normal deviate.
00027 C                              REAL GENNOR
00028 C
00029 C
00030 C                              Method
00031 C
00032 C
00033 C     Renames SNORM from TOMS as slightly modified by BWB to use RANF
00034 C     instead of SUNIF.
00035 C
00036 C     For details see:
00037 C               Ahrens, J.H. and Dieter, U.
00038 C               Extensions of Forsythe's Method for Random
00039 C               Sampling from the Normal Distribution.
00040 C               Math. Comput., 27,124 (Oct. 1973), 927 - 937.
00041 C
00042 C
00043 C**********************************************************************
00044 C     .. Scalar Arguments ..
00045       REAL av,sd
00046 C     ..
00047 C     .. External Functions ..
00048       REAL snorm
00049       EXTERNAL snorm
00050 C     ..
00051 C     .. Executable Statements ..
00052 C     JJV added check to ensure SD >= 0.0 
00053       IF (sd.GE.0.0) GO TO 10
00054       WRITE (*,*) 'SD < 0.0 in GENNOR - ABORT'
00055       WRITE (*,*) 'Value of SD: ',sd
00056       CALL XSTOPX ('SD < 0.0 in GENNOR - ABORT')
00057 
00058  10   gennor = sd*snorm() + av
00059       RETURN
00060 
00061       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines