$random - Generate a random number

`$random` *integer*

0 <= *integer* <= 65535

The **$random** variable returns a unique random number in the range 0 - *n* on reference to the variable.

The random number is derived from the system's random number generator (the quality of which is often dubious so try to avoid using the bottom bits). Setting this variable with any value resets the random sequence using the system time as the seed.

The range of the random number generator is system dependent. The value is typically capped using the &mod(4) arithmetic operator.

The variable may be assigned to generate a new seed as follows:-

set-variable $random 0 ; Set it so we get a new seed

The returned value is used with the **&mod** operator to limit the value to a desired range:-

set-variable %random0to9 &mod $random 10

*Copyright (c) 1998-2006 JASSPA*
*Last Modified: 2002/01/11*
*Generated On: 2006/10/07*