RND function

Syntax

RND (expression)

Description

Use the RND function to generate any positive or negative random integer or 0.

expression evaluates to the total number of integers, including 0, from which the random number can be selected. That is, if n is the value of expression, the random number is generated from the numbers 0 through (n - 1).

If expression evaluates to a negative number, a random negative number is generated. If expression evaluates to 0, 0 is the random number. If expression evaluates to the null value, the RND function fails and the program terminates with a run-time error message.

See the RANDOMIZESyntax statement for details on generating repeatable sequences of random numbers.

Example

A=20
PRINT RND(A)
PRINT RND(A)
PRINT RND(A)
PRINT RND(A)

This is the program output:

10
3
6
10