Returns a random number.
||An expression that resolves to an integer, specified as a number or a numeric string.
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 number
is a fractional number it is truncated to its integer portion. If number
is a negative number, a negative number is returned.
string value is parsed as a number until a non-numeric 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 non-numeric string or the empty string (""), it is parsed as 0, and thus RND
always returns 0.
The following example generates twenty random numbers in the range 0 through 99 (inclusive):
FOR x=1 TO 20
© 1997-2019 InterSystems Corporation, Cambridge, MA