Top | Up (RNG) | < Previous (RANDOMIZE) | Next (RNDF) >
Returns a random integer in [0,range)
(0
to range-1
), using one of the randomizer channels.
RND [ channel%, ] range% OUT value%
parameter | description |
---|---|
channel% | randomizer channel to use; 0 if omitted |
range% | the number of values to choose from. 0 to 2147483647 . RND returns 0 if range% is 0 . |
Print a random number from 1 to 6:
PRINT RND(6)+1
Passing a range of 0 to RND would result in garbage output.2
Fixes range-0 bug.2
1 12Me21, “Random Numbers.” https://smilebasicsource.com/page?pid=992
2 SmileBoom, “Fixes in Ver. 3.0.2 (January 7, 2015).” http://smilebasic.com/en/debug/archive/