Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. GetRnd

    Description

    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.

    Parameters

    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.

    Return Value

    A integer random value.

    Example of use

    // 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(); } }

    See Also

    none.

     
  2. Google+