Math.chance(percent) +
Top  Previous  Next


SWiSH Player Support
SWF4 or later - Supported Internally

Syntax
Math.chance(percent)

Arguments
The percentage of time that the function should return 1 (or true).

Returns
0 or 1.

Description
Returns 1 or 0 depending on random chance.
On average, 1 is returned per cent of the time.

Sample
Math.randomInt(25
);   // will return 1 on 25% of occasions. i.e. 1 in 4 chance

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

See also

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