genexp.f

Go to the documentation of this file.
00001       REAL FUNCTION genexp(av)
00002 
00003 C**********************************************************************
00004 C
00005 C     REAL FUNCTION GENEXP( AV )
00006 C
00007 C                    GENerate EXPonential random deviate
00008 C
00009 C
00010 C                              Function
00011 C
00012 C
00013 C     Generates a single random deviate from an exponential
00014 C     distribution with mean AV.
00015 C
00016 C
00017 C                              Arguments
00018 C
00019 C
00020 C     AV --> The mean of the exponential distribution from which
00021 C            a random deviate is to be generated.
00022 C                              REAL AV
00023 C     JJV                      (AV >= 0)
00024 C
00025 C     GENEXP <-- The random deviate.
00026 C                              REAL GENEXP
00027 C
00028 C
00029 C                              Method
00030 C
00031 C
00032 C     Renames SEXPO from TOMS as slightly modified by BWB to use RANF
00033 C     instead of SUNIF.
00034 C
00035 C     For details see:
00036 C
00037 C               Ahrens, J.H. and Dieter, U.
00038 C               Computer Methods for Sampling From the
00039 C               Exponential and Normal Distributions.
00040 C               Comm. ACM, 15,10 (Oct. 1972), 873 - 882.
00041 C
00042 C**********************************************************************
00043 C     .. Scalar Arguments ..
00044       REAL av
00045 C     ..
00046 C     .. External Functions ..
00047       REAL sexpo
00048       EXTERNAL sexpo
00049 C     ..
00050 C     .. Executable Statements ..
00051 C     JJV added check to ensure AV >= 0.0 
00052       IF (av.GE.0.0) GO TO 10
00053       WRITE (*,*) 'AV < 0.0 in GENEXP - ABORT'
00054       WRITE (*,*) 'Value of AV: ',av
00055       CALL XSTOPX ('AV < 0.0 in GENEXP - ABORT')
00056 
00057  10   genexp = sexpo()*av
00058       RETURN
00059 
00060       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines