Skip to content

Latest commit

 

History

History
75 lines (62 loc) · 2.3 KB

RND.org

File metadata and controls

75 lines (62 loc) · 2.3 KB

Top | Up (RNG) | < Previous (RANDOMIZE) | Next (RNDF) >

RND

Returns a random integer in [0,range) (0 to range-1), using one of the randomizer channels.

Syntax

RND [ channel%, ] range% OUT value%
parameterdescription
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.

Examples

Print a random number from 1 to 6:

PRINT RND(6)+1

Version Information

3.0.0

Passing a range of 0 to RND would result in garbage output.2

3.0.2

Fixes range-0 bug.2

References

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/


Top | Up (RNG) | < Previous (RANDOMIZE) | Next (RNDF) >