|
Functions for generating random numbers. More...
Functions | |
float | getRandom (int a=1, int b=0) |
Get a random number between a and b. | |
int | getRandomSeed () |
Get the current seed used by the random number generator. | |
void | setRandomSeed (int seed=-1) |
Set the current seed for the random number generator. |
Functions for generating random numbers.
Based on a seed, the random number generator produces a sequence of numbers. As a given seed will always produce the same sequence of numbers this can be used to generate re-producible sequences of apparently random numbers.
To set the seed, call setRandomSeed().
float getRandom | ( | int | a = 1 , |
|
int | b = 0 | |||
) |
Get a random number between a and b.
a | Lower bound on the random number. The random number will be >= a. | |
b | Upper bound on the random number. The random number will be <= b. |
int getRandomSeed | ( | ) |
Get the current seed used by the random number generator.
void setRandomSeed | ( | int | seed = -1 |
) |
Set the current seed for the random number generator.
Based on this seed, a repeatable sequence of numbers will be produced by getRandom().
seed | The seed with which to initialize the randon number generator with. The same seed will always leed tothe same sequence of pseudo-random numbers. If -1, the current timestamp will be used as the seed which is a good basis for randomization. |