## RND() |

The RND() function returns a random number.
Format
RND(expr)
where
The RND() function returns a random number. The range of values is determined by the value of expr rounded towards zero as an integer. If expr is positive, the number is in the range zero to expr minus one. If expr is negative, the number is in the range expr plus one to zero. If expr is zero, RND() returns zero.
If expr is a numeric array (a dynamic array where all elements are numeric), the RND() function operates on each element in turn and returns a numeric array with the same structure as expr.
The seed value of the random number generator may be set using RANDOMIZE. Note that the sequence returned may vary between QM releases even if the same seed value is set.
Example
TWO.DICE = RND(6) + RND(6) + 2
This statement produces a value in TWO.DICE equivalent to throwing a pair of dice. The two calls to the RND() function will each return a value in the range 0 to 5. The values are then brought into the appropriate range by adding two.
See also: |