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

A Simple Random Variable

Program gif defines the SimpleRV class. The SimpleRV class implements the RandomVariable interface defined in Program gif. This class generates random numbers uniformly distributed in the interval (0,1).

   program33584
Program: SimpleRV class.

The implementation of the SimpleRV class is trivial because the RandomNumberGenerator class generates the desired distribution of random numbers. Consequently, the nextDouble method simply calls RandomNumberGenerator.Next.


next up previous contents index

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