Functions relating to the generation of random numbers.
Use the getRandom function to get a random floating-point or integer value. This function comes in three forms. The first getRandom() takes no arguments and will return a random floating-point value in the range of 0.0 to 1.0. The second getRandom( max ) takes one argument representing the max integer value this will return. It will return an integer value between 0 and max. The third getRandom( min , max ) takes two arguments representing the min and max integer values this will return. It will return an integer value between min and max. Only the no-args version will return a floating point.
- Parameters
-
| min | Minimum inclusive integer value to return. |
| max | Maximum inclusive integer value to return. |
- Returns
- If no arguments are passed, will return a floating-point value between 0.0 and 1.0. If one argument is passed, will return an integer value between 0 and max inclusive. If two arguments are passed, will return an integer value between min and max inclusive.
- See Also
- getRandomSeed
| float getRandomF |
( |
min |
, |
|
|
max |
|
|
) |
| |
Gets a random floating-point number from min to max.
- Parameters
-
| min | The minimum range of the random floating-point number. |
| max | The maximum range of the random floating-point number. |
- Returns
- A random floating-point number from min to max.
Use the getRandomSeed function to get the current seed for the random generator. You can re-seed the generator with this value to allow you to recreate a random sequence. Merely save the seed and execute your random sequence. Later, to reproduce this sequence re-seed the generator with setRandomSeed and your saved value. Then, the generator will produce the same random sequence that followed the call to getRandomSeed.
- Returns
- Returns an integer value representing the current seed of the random generator.
- See Also
- getRandom, setRandomSeed
| void setRandomSeed |
( |
startSeed |
| ) |
|
Use the setRandomSeed function to initialize the random number generator with the initial seed of startSeed.
- Parameters
-
| startSeed | The new starting seed value for the random generator. |
- Returns
- No return value.
- See Also
- getRandom, getRandomSeed