Random Whole Number | MATH_RANDOM_INT

Syntax

MATH_RANDOM_INT( [min = 0], [max] )

Parameters

min optional
A number that is the minimum value to be returned. If the value is not an INTEGER, the INTEGER operation will be used to convert it.

max
A number that is the maximum value to be returned. If the value is not a INTEGER, the INTEGER operation will be used to convert it.

Return Value

Returns a random number in the specified range.

Description

Get a random value in a range. If only one value is provided it is used as the MAX and the MIN is set to 0. This operation works the same as MATH_RANDOM except that the result is always an INTEGER.

Examples

MATH_RANDOM_INT() # returns 0
MATH_RANDOM_INT(12) # returns an integer between 0 and 12
MATH_RANDOM_INT(10, 20) # returns an integer between 10 and 20