#include <SIM_Random.h>

Public Member Functions | |
| void | setSeed (uint seed) |
| Sets the seed to the system. | |
| uint | urandom () |
| Gets a random unsigned integer. | |
| fpreal | frandom () |
| Returns a random float from [0..1). | |
| fpreal | frandom0 () |
| Returns a random float from [-.5...5). | |
| int | choice (int choices) |
| int | irange (int a, int b) |
| fpreal | frange (fpreal a, fpreal b) |
| bool | chance (fpreal probability) |
Protected Member Functions | |
| SIM_Random (const SIM_DataFactory *factory) | |
| virtual | ~SIM_Random () |
| virtual void | setSeedSubclass (uint seed)=0 |
| Override this function to initialize the random number generator. | |
| virtual uint | urandomSubclass ()=0 |
| Override this function to implement a new random number generator. | |
Definition at line 24 of file SIM_Random.h.
| SIM_Random::SIM_Random | ( | const SIM_DataFactory * | factory | ) | [explicit, protected] |
| virtual SIM_Random::~SIM_Random | ( | ) | [protected, virtual] |
| bool SIM_Random::chance | ( | fpreal | probability | ) |
Returns true with the givent probability. < 0 always false, > 1 always true.
| int SIM_Random::choice | ( | int | choices | ) |
Returns a random integer from [0..choices-1] 0 choices will return 0. Negative choices will go for [-choices+1..0]
| fpreal SIM_Random::frandom | ( | ) |
| fpreal SIM_Random::frandom0 | ( | ) |
Returns a random float from [-.5...5).
| int SIM_Random::irange | ( | int | a, | |
| int | b | |||
| ) |
Returns a number within the range [a..b] In the floating point case, the range is [a..b)
| void SIM_Random::setSeed | ( | uint | seed | ) |
Sets the seed to the system.
| virtual void SIM_Random::setSeedSubclass | ( | uint | seed | ) | [protected, pure virtual] |
| uint SIM_Random::urandom | ( | ) |
Gets a random unsigned integer.
| virtual uint SIM_Random::urandomSubclass | ( | ) | [protected, pure virtual] |
Override this function to implement a new random number generator.
Implemented in SIM_RandomTwister.
1.5.9