Rnd function

Description

Returns a random numeric integer. You can use the InitRnd statement to initialize the Rnd function.

Syntax

random = Rnd(expression)

Parameters

The Rnd function has the following parameters.

Parameter

Description

Expression

Any legal BASIC+ expression.

 

The Rnd function returns a random number that is from 0 (zero) to the designated number. For example, in

N = Rnd(500)

the variable identifier N will be assigned a random number from 0 to 500. Note that 0 (zero) is a possible number in the random selection.

An expression designating null or (0) returns a (0). A negative expression returns a negative random number.

See also

InitRnd

Example

/* Assigns a number between 0 and 100. */

random_num = Rnd(100)