SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Abstract base class from which the random number generator classes derive. More...
#include <rw/rand.h>
Public Member Functions | |
RWTRand () | |
RWTRand (const Generator &g) | |
RWTRand (const RWTRand< Generator > &x) | |
const Generator & | generator () const |
Generator & | generator () |
void | setGenerator (const Generator &x) |
void | setGenerator (const RWTRand< Generator > &x) |
Public Member Functions inherited from RWRandInterface | |
virtual double | operator() ()=0 |
Class RWTRand is the abstract base class for the random number generator classes. The classes derived from RWTRand generate random numbers from specific probability distributions. Each of these derived classes generates a random number from a uniform distribution on the interval [0, 1], and from this deviate derives a random number generator from the appropriate probability distribution. The template parameter Generator
is a function object that provides this uniform [0, 1] deviate. Specifically, Generator
is presumed to be an object that overloads the function call operator to return a uniform random number of type double
between 0 and 1.
The class Generator must have the following semantics, where gen
is of type Generator:
Default Constructor: | Generator gen;
|
Function Call Operator: | double x = gen(); // 0 <= x <= 1 or 0 < x < 1
|
Uses the default constructor of class Generator to initialize the underlying uniform random number generator.
Initializes the underlying uniform random number generator with g.
Initializes the underlying uniform random number generator with x's.
|
inline |
Returns the underlying uniform random number generator as a const
reference.
|
inline |
Returns a reference to the underlying uniform random number generator.
void RWTRand< Generator >::setGenerator | ( | const Generator & | x | ) |
Sets the underlying uniform random number generator to x.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |