GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
genexp.f
Go to the documentation of this file.
1  REAL FUNCTION genexp(av)
2 
3 C**********************************************************************
4 C
5 C REAL FUNCTION GENEXP( AV )
6 C
7 C GENerate EXPonential random deviate
8 C
9 C
10 C Function
11 C
12 C
13 C Generates a single random deviate from an exponential
14 C distribution with mean AV.
15 C
16 C
17 C Arguments
18 C
19 C
20 C AV --> The mean of the exponential distribution from which
21 C a random deviate is to be generated.
22 C REAL AV
23 C JJV (AV >= 0)
24 C
25 C GENEXP <-- The random deviate.
26 C REAL GENEXP
27 C
28 C
29 C Method
30 C
31 C
32 C Renames SEXPO from TOMS as slightly modified by BWB to use RANF
33 C instead of SUNIF.
34 C
35 C For details see:
36 C
37 C Ahrens, J.H. and Dieter, U.
38 C Computer Methods for Sampling From the
39 C Exponential and Normal Distributions.
40 C Comm. ACM, 15,10 (Oct. 1972), 873 - 882.
41 C
42 C**********************************************************************
43 C .. Scalar Arguments ..
44  REAL av
45 C ..
46 C .. External Functions ..
47  REAL sexpo
48  EXTERNAL sexpo
49 C ..
50 C .. Executable Statements ..
51 C JJV added check to ensure AV >= 0.0
52  IF (av.GE.0.0) GO TO 10
53  WRITE (*,*) 'AV < 0.0 in GENEXP - ABORT'
54  WRITE (*,*) 'Value of AV: ',av
55  CALL xstopx ('AV < 0.0 in GENEXP - ABORT')
56 
57  10 genexp = sexpo()*av
58  RETURN
59 
60  END
real function sexpo()
Definition: sexpo.f:2
real function genexp(av)
Definition: genexp.f:2