A function which returns a random number. The type and range of the number returned depends upon the optional parameter.
Argument | Result |
---|---|
RND | Returns a random integer 1 - &FFFFFFFF. |
RND(1) | Returns a real number in the range 0.0 to .99999999. |
RND(0) | Returns the previous random number in RND(1) format. |
RND(n>1) | Returns an integer in the range 1 to n (n>1). |
RND(n<0) | Seeds the pseudo-random sequence generator and returns the seed value. |
The random number generator is initialised by RUN (or CHAIN). Consequently, RND will return zero until the RUN (or CHAIN) command is first issued.
X=RND(1)
X%=RND
N=RND(6)
Syntax
<n-var>=RND[(<numeric>)]