util.Math.rand

Returns a positive pseudo-random number.

Syntax

util.Math.rand(
   max INTEGER )
  RETURNING result INTEGER
  1. max is the maximum random number that can be generated.

Usage

The srand() function initializes the pseudo-random numbers generator. It must be called before subsequent calls to the rand() function. If you do not call the srand() function, the rand() function will generate the same sequence of numbers for every program execution.

The maximum random number returned by the rand() function is platform dependent. On most platforms, the max will be 32767. As a general rule, you should pass a number between 0 and 32767 to the rand() function.

Numbers will be in the range 0 to max. The max value returned by the function cannot be greater as 32767 on most platforms.

The rand() function returns zero if the argument is lower or equal to 0.