Program defines the ExponentialRV class.
This class generates exponentially distributed random numbers
with a mean value of
.
The mean value
is specified in the constructor.
The ExponentialRV class generates a sequence of random numbers, ,
exponentially distributed
on the interval
and having a mean value
.
The numbers are said to be exponentially distributed because
the probability that
falls between 0 and z is given by
where .
The function p(x) is called the
probability density function .
Thus,
Notice that is a value between zero and one.
Therefore, given a random variable,
,
uniformly distributed between zero and one,
we can obtain an exponentially distributed variable
as follows:
Note, if is uniformly distributed on (O,1),
then so too is
.
The implementation of the nextDouble method
follows directly from Equation
.