System Functions
RND( ) Return Random Number
   
Format RND(seed[,ERR=stmtref])
 
Where:
seed Numeric expression must be (or result in) an integer. The value of this number is used to determine the result of the function.
stmtref Program line number or statement label to which to transfer control.
   
Returns Random numbers based on given seed.
   
Description The RND( ) function returns random numbers based on the seed given. The following table describes the value returned based on the seed value:
> 0 If seed is greater than zero, the random number returned iwill range from zero to one less than the given number.
= 0 If seed equals 0 (zero), the random number returned is between 0 and 1, with PRECISION=8.
< 0 If seed is less than zero, the function initializes the seed value used to generate random numbers and returns a random number between 0 and 1 with PRECISION=8.

Each call to the RND( ) function will return a different random number. To change the seed value for the random number generation you can either execute a RANDOMIZE directive or call RND( ) with a negative value. If your value is not an integer, ProvideX returns Error #41: Invalid integer encountered (range error or non-integer).  

   
See Also RANDOMIZE Directive
RND System Variable
   
Example 0010 REM
0020 FOR I=1 TO 10
0030 PRINT RND(9),
0040 NEXT
0050 PRINT 'LF',RND(0)
0060 PRINT RND(-1)
0070 PRINT " DONE"; END
-:run
1 1 7 0 7 7 4 4 5 7
0.05947216
0.11337858
DONE