integer GetRnd(integer Boundary)
Return an integer random number between 0 and Boundary(included).This is an internal very fast generator providing a good distribution for video game randomness needs (minimizing visible patterns and fast execution). This function will run the same way on different systems because it doesn't rely on system function(which may have variable quality RNG). So we recommend you use it instead of other functions.
Boundary : The higher limit for the returned random number. If you give 1 for boundary, the function will return 0 or 1. If you use 0 for boundary, the function will return a full range 32 bit random number.
A integer random value.
// Listing #1: Random Number display demo
Time <- 0;
function Voxel_Step()
{
local RandomNumber;
// The robot will play at 2 second interval.
if ( (GetGameTime() - Time) > 2000 )
{
// Get a random number between 0 and 1000000 and display it.
RandomNumber = GetRnd(0,1000000);
Display( "RANDOM NUMBER : " + RandomNumber, 1900, 2);
// Store actual timestamp for the next 2 second delay.
Time = GetGameTime();
}
}
none.