Om
1.0.0
A universal framework for multimedia simulation
|
A class representing a random number generator for the templated data type. More...
#include <omRandom.h>
Classes | |
class | State |
Public Types | |
typedef RNG< WIDTH > | RNGType |
The type used for the internal random number generator. More... | |
typedef RNG< WIDTH >::SeedType | SeedType |
The underlying type used to represent the random seed. More... | |
typedef RNG< WIDTH >::OutputType | OutputType |
The underlying unsigned integer type that is the output of the PRNG. More... | |
Public Member Functions | |
Random () | |
Create a random variable with a default initial seed value derived from the current system time. More... | |
Random (SeedType newSeed) | |
Create a random variable with the specified initial seed value. More... | |
T | sample () |
Generate a sample from the random variable and return the result. More... | |
T | sample (T min, T max) |
Generate a sample from the random variable in the specified range. More... | |
void | setSeed (SeedType newSeed) |
Set the initial seed for the random variable. More... | |
void | setState (const SeedType newState[WIDTH]) |
Set the entire state for the random variable. More... | |
void | setState (const State &newState) |
Set the entire state for the random variable. More... | |
const State & | getState () const |
Return an object containing the internal state storage of this random variable. More... | |
Size | getStateSize () const |
Return the number of elements that make up the state of this random variable. More... | |
template<> | |
float | sample () |
template<> | |
float | sample (float min, float max) |
template<> | |
double | sample () |
template<> | |
double | sample (double min, double max) |
Static Public Attributes | |
static const Size | WIDTH = sizeof(T) |
The number of seed values used as the state of this random variable. More... | |
static const Size | SEED_SIZE = RNGType::SEED_SIZE |
The number of seed values that are part of the random state. More... | |
A class representing a random number generator for the templated data type.
typedef RNG<WIDTH> om::math::Random< T, RNG >::RNGType |
The type used for the internal random number generator.
typedef RNG<WIDTH>::SeedType om::math::Random< T, RNG >::SeedType |
The underlying type used to represent the random seed.
typedef RNG<WIDTH>::OutputType om::math::Random< T, RNG >::OutputType |
The underlying unsigned integer type that is the output of the PRNG.
|
inline |
Create a random variable with a default initial seed value derived from the current system time.
|
inline |
Create a random variable with the specified initial seed value.
|
inline |
Generate a sample from the random variable and return the result.
The value returned may have any numerical value representable by the random variable's data type. The pseudorandom values returned over successive calls to this function will lie in a uniform distribution.
|
inline |
Generate a sample from the random variable in the specified range.
The value returned can have any numerical value between and including the minimum and maximum values specified. The pseudorandom values returned over successive calls to this function will lie in a uniform distribution.
|
inline |
Set the initial seed for the random variable.
If the PRNG state is larger than one seed value, a simple RNG is used to generate the rest of the state from the initial seed. After setting the seed for the random variable, calls to the sample() methods will produce the same sequence of values for equal initial seed values.
|
inline |
Set the entire state for the random variable.
After setting the state for the random variable, calls to the sample() methods will produce the same sequence of values for equal initial seed values.
|
inline |
Set the entire state for the random variable.
After setting the state for the random variable, calls to the sample() methods will produce the same sequence of values for equal initial seed values.
|
inline |
Return an object containing the internal state storage of this random variable.
|
inline |
Return the number of elements that make up the state of this random variable.
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
The number of seed values used as the state of this random variable.
|
static |
The number of seed values that are part of the random state.