Data Structures and Algorithms with Object-Oriented Design Patterns in C#
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_inline68444. The mean value tex2html_wrap_inline68444 is specified in the constructor.

   program33870
Program: ExponentialRV class.

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

displaymath68442

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

eqnarray33892

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

  eqnarray33900

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


next up previous contents index

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