Relacs Numerics Library
0.9.8
|
#include <random.h>
Public Member Functions | |
RandomStd (void) | |
RandomStd (unsigned long seed) | |
virtual | ~RandomStd (void) |
virtual unsigned long | setSeed (unsigned long seed) |
virtual unsigned long | integer (void) |
virtual unsigned long | min (void) const |
virtual unsigned long | max (void) const |
unsigned long | operator() (unsigned long n) |
double | operator() (void) |
virtual double | uniform (void) |
virtual double | gaussian (void) |
virtual double | exponential (void) |
virtual double | gamma (int a) |
virtual string | name (void) |
Public Member Functions inherited from RandomBase | |
RandomBase (void) | |
RandomBase (unsigned long seed) | |
virtual | ~RandomBase (void) |
unsigned long | operator() (unsigned long n) |
double | operator() (void) |
An implementation of RandomBase with the random number generator from the standard C library.
RandomStd | ( | void | ) |
References RandomStd::setSeed().
RandomStd | ( | unsigned long | seed | ) |
References RandomStd::setSeed().
|
virtual |
|
virtual |
Set the seed of the random number generator to seed. If seed is 0, then the system time is used to generate a seed to imitate real randomness. Returns the seed.
Implements RandomBase.
Referenced by RandomStd::RandomStd().
|
virtual |
Returns a uniformly distributed random integer between min() and max().
Implements RandomBase.
|
virtual |
The minimum value integer() returns.
Implements RandomBase.
|
virtual |
The maximum value integer() returns.
Implements RandomBase.
|
inline |
Returns an uniformly distributed integer random number between zero and n. The range includes 0 but excludes n. This operator conforms to the STL RandomNumberGenerator specification. This function is NOT virtual in order to speed up computation.
References relacs::ceil().
|
inline |
Returns a uniformly distributed random number between zero and one. The range includes 0.0 but excludes 1.0. This function is NOT virtual in order to speed up computation.
Referenced by RandomStd::exponential(), RandomStd::gamma(), and RandomStd::gaussian().
|
virtual |
Returns a uniformly distributed random number between zero and one. The range includes 0.0 but excludes 1.0.
Implements RandomBase.
|
virtual |
Returns a unit gaussian distributed random number.
Implements RandomBase.
References relacs::log(), RandomStd::operator()(), and relacs::sqrt().
|
virtual |
Returns an exponential distributed random number with mean one.
Reimplemented from RandomBase.
References relacs::log(), and RandomStd::operator()().
|
virtual |
Returns a gamma distributed random number p(x) dx = x^(a-1) exp(-x)/Gamma(a) dx.
Reimplemented from RandomBase.
References relacs::exp(), relacs::log(), RandomStd::operator()(), and relacs::sqrt().
|
virtual |
The name of the random number generator ("rand").
Implements RandomBase.