Random
Functions
float
getRandom(int a, int b)
Returns a random number based on parameters passed in..
int
Get the current seed used by the random number generator.
void
setRandomSeed(int seed)
Set the current seed for the random number generator.
Detailed Description
Functions
getRandom(int a, int b)
Returns a random number based on parameters passed in..
If no parameters are passed in, getRandom() will return a float between 0.0 and 1.0. If one parameter is passed an integer between 0 and the passed in value will be returned. Two parameters will return an integer between the specified numbers.
Parameters:
a | If this is the only parameter, a number between 0 and a is returned. Elsewise represents the lower bound. |
b | Upper bound on the random number. The random number will be <= b. |
A pseudo-random integer between a and b, between 0 and a, or a float between 0.0 and 1.1 depending on usage.
note:All parameters are optional.
getRandomSeed()
Get the current seed used by the random number generator.
The current random number generator seed value.
setRandomSeed(int seed)
Set the current seed for the random number generator.
Based on this seed, a repeatable sequence of numbers will be produced by getRandom(). Parameters:
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. |