Math.randomInt(max) +
Top  Previous  Next


SWiSH Player Support
SWF4 or later - Supported Internally

Syntax
Math.randomInt(max)

Arguments
max: An integer number or expression > 0.

Returns
A random integer.

Description
Returns a random integer n, where 0 <= n < max.

Sample
Math.randomInt(5
);   // will randomly return one of the values 0, 1, 2, 3 or 4

Flash MX Differences
This function is not implemented in Flash MX.

See also

Math.chance(), Math.random(), Math.randomInt() and Max.randomRange().