Index
Math Utility

RandInt

randInt(<-first <-second) ->randi

Description

Returns a random integer from a range of two numbers inclusive of the first number, but exclusive of the second number. A workaround for between 0 and 10 both inclusive is in the example below. It is to do 0 11 RandInt, so 11 will exclude but 10 will include [basically, 0 10 1 add RandInt]

General convention would be having the first number be lower, but it does also work in reverse, but the second number stays as the exclusive one. I.e. RandInt (1 -1) can return 1 or 0.

Examples

# get a random integer between 0 and 10 (both numbers inclusive)
RandInt(0 11)
#
# or
#
RandInt( 0 10 add (1)) # functionally equivalent.

See Also

RandFloat

Index