|
SeedType | GetSeed (void) const |
|
void | SetSeed (const SeedType seed) |
|
SequenceCounterType | GetSequencePosition (void) const |
|
void | SetSequencePosition (const SequenceCounterType position) |
|
ElementaryRandomNumber | ExtractRandomElement (void) |
|
float | ExtractRandomFloat (void) |
|
float | ExtractRandomFloat (const float min, const float max) |
|
void | ExtractRandomFloatArray (const float min, const float max, float *array, const size_t arraySize) |
|
double | ExtractRandomDouble (void) |
|
double | ExtractRandomDouble (const double min, const double max) |
|
void | ExtractRandomDoubleArray (const double min, const double max, double *array, const size_t arraySize) |
|
int | ExtractRandomInt (void) |
|
int | ExtractRandomInt (const int min, const int max) |
|
void | ExtractRandomIntArray (const int min, const int max, int *array, const size_t arraySize) |
|
unsigned int | ExtractRandomUnsignedInt (void) |
|
unsigned int | ExtractRandomUnsignedInt (const unsigned int min, const unsigned int max) |
|
void | ExtractRandomUnsignedIntArray (const unsigned int min, const unsigned int max, unsigned int *array, const size_t arraySize) |
|
short | ExtractRandomShort (void) |
|
short | ExtractRandomShort (const short min, const short max) |
|
void | ExtractRandomShortArray (const short min, const short max, short *array, const size_t arraySize) |
|
unsigned short | ExtractRandomUnsignedShort (void) |
|
unsigned short | ExtractRandomUnsignedShort (const unsigned short min, const unsigned short max) |
|
void | ExtractRandomUnsignedShortArray (const unsigned short min, const unsigned short max, unsigned short *array, const size_t arraySize) |
|
long | ExtractRandomLong (void) |
|
long | ExtractRandomLong (const long min, const long max) |
|
void | ExtractRandomLongArray (const long min, const long max, long *array, const size_t arraySize) |
|
unsigned long | ExtractRandomUnsignedLong (void) |
|
unsigned long | ExtractRandomUnsignedLong (const unsigned long min, const unsigned long max) |
|
void | ExtractRandomUnsignedLongArray (const unsigned long min, const unsigned long max, unsigned long *array, const size_t arraySize) |
|
long long | ExtractRandomLongLong (void) |
|
long | ExtractRandomLongLong (const long long min, const long long max) |
|
void | ExtractRandomLongLongArray (const long long min, const long long max, long long *array, const size_t arraySize) |
|
unsigned long long | ExtractRandomUnsignedLongLong (void) |
|
unsigned long long | ExtractRandomUnsignedLongLong (const unsigned long long min, const unsigned long long max) |
|
void | ExtractRandomUnsignedLongLongArray (const unsigned long long min, const unsigned long long max, unsigned long long *array, const size_t arraySize) |
|
char | ExtractRandomChar (void) |
|
char | ExtractRandomChar (const char min, const char max) |
|
void | ExtractRandomCharArray (const char min, const char max, char *array, const size_t arraySize) |
|
unsigned char | ExtractRandomUnsignedChar (void) |
|
unsigned char | ExtractRandomUnsignedChar (const unsigned char min, const unsigned char max) |
|
void | ExtractRandomUnsignedCharArray (const unsigned char min, const unsigned char max, unsigned char *array, const size_t arraySize) |
|
void | ExtractRandomPermutation (const size_t length, size_t *array) |
|
|
template<typename _valueType > |
void | ExtractRandomValue (_valueType &result) |
|
template<typename _valueType > |
void | ExtractRandomValue (const _valueType min, const _valueType max, _valueType &result) |
|
template<typename _valueType > |
void | ExtractRandomValueArray (const _valueType min, const _valueType max, _valueType *array, const size_t arraySize) |
|
|
size_t | ExtractRandomSizeT (const size_t min, const size_t max) |
|
void | ExtractRandomSizeTArray (const size_t min, const size_t max, size_t *array, const size_t arraySize) |
|
ptrdiff_t | ExtractRandomPtrdiffT (const ptrdiff_t min, const ptrdiff_t max) |
|
void | ExtractRandomPtrdiffTArray (const ptrdiff_t min, const ptrdiff_t max, ptrdiff_t *array, const size_t arraySize) |
|
Provide an interface to a reproducible random sequence.
Class cmnRandomSequence provides a reproducible random sequence. A random sequence is defined as a sequence of elements of type ElementaryRandomNumber, which is generated by a more or less good random number generator. The random number generator is initialized with a seed, and outputs a sequence of numbers.
In order to reproduce a random sequence, we need to store the seed and the position in the sequence. We can then resume to any position in the sequence using the method SetSequencePosition().
Important note: In the current implementation, we are using the rand() function of the standard C/C++ library. However, as the rand() function does not have a cross-platform standardized behavior, our random sequence is only reproducible within the scope of one compiler on one machine. In addition, as we depend on a global mechanism, all the random sequences use the same resource. This means that in fact, there is only one random sequence in the system. Therefore, the current implementation is as a Singleton.
Useful background on randomization can be found, for example, in Numerical Recipes: http://www.nr.com . Due to copyright issues, we are currently delaying its use. Another possible source for randomization functions is in the Gnu Scientific Library (GSL): http://www.gnu.org/software/gsl/gsl.html .