Caché MultiValue Basic Reference
RND


Returns a random number.
Synopsis
Arguments
Description
The
RND function returns a random value between zero and the specified
number, inclusive of zero but exclusive of
number. Thus the available range of returned numbers is 0 through
number1.
If
number is a fractional number it is truncated to its integer portion. If
number is a negative number, a negative number is returned.
A
number string value is parsed as a number until a nonnumeric character is encountered. Thus “7dwarves” is parsed as 7. If
number resolves to 1, 0, or 1,
RND always returns 0. If
number is a nonnumeric string or the empty string (""), it is parsed as 0, and thus
RND always returns 0.
Examples
The following example generates twenty random numbers in the range 0 through 99 (inclusive):
FOR x=1 TO 20
PRINT RND(100)
NEXT
See Also