RNEXP
Generates pseudorandom numbers from a standard exponential distribution.
Required Arguments
R — Vector of length NR containing the random standard exponential deviates. (Output)
Optional Arguments
NR — Number of random numbers to generate. (Input)
Default: NR = size (R,1).
FORTRAN 90 Interface
Generic: CALL RNEXP (R [])
Specific: The specific interface names are S_RNEXP and D_RNEXP.
FORTRAN 77 Interface
Single: CALL RNEXP (NR, R)
Double: The double precision name is DRNEXP.
Description
Routine RNEXP generates pseudorandom numbers from a standard exponential distribution. The probability density function is f(x) = ex for x > 0. RNEXP uses an antithetic inverse CDF technique; that is, a uniform random deviate U is generated and the inverse of the exponential cumulative distribution function is evaluated at 1.0  U to yield the exponential deviate.
Deviates from the exponential distribution with mean THETA can be generated by using RNEXP and then multiplying each entry in R by THETA. The following statements (in single precision using the routine SSCAL (Reference Material)) would yield random deviates from such a distribution:
USE IMSL_LIBRARIES
CALL RNEXP (R, NR)
CALL SSCAL (NR, THETA, R, 1)
Comments
The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.
Example
In this example, RNEXP is used to generate five pseudorandom deviates from a standard exponential distribution.
 
USE RNEXP_INT
USE UMACH_INT
USE RNSET_INT
 
IMPLICIT NONE
INTEGER ISEED, NOUT, NR
REAL R(5)
!
CALL UMACH (2, NOUT)
NR = 5
ISEED = 123457
CALL RNSET (ISEED)
CALL RNEXP (R)
WRITE (NOUT,99999) R
99999 FORMAT (' Exponential random deviates: ', 5F8.4)
END
Output
 
Exponential random deviates: 0.0344 1.3443 0.2662 0.5633 0.1686
Published date: 03/19/2020
Last modified date: 03/19/2020