Data Structures and Algorithms with Object-Oriented Design Patterns in C#
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).

   program33836
Program: SimpleRV class.

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


next up previous contents index

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