Name

random( ) Global Function — generate a random number

Availability

Flash 4; deprecated in Flash 5 in favor of Math.random( )

Synopsis

random(number)

Arguments

number

A positive integer.

Returns

A random integer greater than or equal to 0 and less than number.

Description

The deprecated random( ) function was used in Flash 4 to generate random numbers. This function has been retired from the language and is available only for the sake of backward compatibility. In Flash 5 and higher, use the preferred Math.random( ) method. Note that random( ) generated integers from to number -1, whereas Math.random( ) generates floats from 0.0 to .999.

See Also

Math.random( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.