Logo Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Exponentially Distributed Random Variables

Program gif defines the ExponentialRV class. This class generates exponentially distributed random numbers with a mean value of tex2html_wrap_inline68257. The mean value tex2html_wrap_inline68257 is specified in the constructor.

   program33698
Program: ExponentialRV class.

The ExponentialRV class generates a sequence of random numbers, tex2html_wrap_inline68261, exponentially distributed  on the interval tex2html_wrap_inline68263 and having a mean value tex2html_wrap_inline68257. The numbers are said to be exponentially distributed because the probability that tex2html_wrap_inline68261 falls between 0 and z is given by

displaymath68255

where tex2html_wrap_inline68273. The function p(x) is called the probability density function . Thus,

eqnarray33720

Notice that tex2html_wrap_inline68277 is a value between zero and one. Therefore, given a random variable, tex2html_wrap_inline68247, uniformly distributed between zero and one, we can obtain an exponentially distributed variable tex2html_wrap_inline68261 as follows:

  eqnarray33728

Note, if tex2html_wrap_inline68247 is uniformly distributed on (O,1), then so too is tex2html_wrap_inline68287. The implementation of the nextDouble method follows directly from Equation gif.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.