Action
Returns a random number.
Syntax
var = RND(limit)
Remarks
Limit |
The maximum number that will be assigned to the random number. |
The RND() function uses 2 internal bytes to store the value of the random seed.
It is important to understand that the RND() function is a math function. Every time you reset the micro, it will produce the same sequence. Only when you vary the variables with for example a timer, temperature reading, or a clock, you can make a more random value.
See also
NONE
Example
'---------------------------------------------------------
' (c) 1995-2006 MCS Electronics
' RND.BAS
'---------------------------------------------------------
Dim W As Word
Do
'get a random number and limit it to be maximum 100
W = Rnd(100)
Print W
Loop
End