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