Saturday, June 7, 2008

Flash Tutorial ActionScript 3 Training - Math.random explanation and code example

Math.random() does not need a number to be passed to it and returns a random value between 0 and 1. The following example will return a random number between 1 and 10.

ActionScript 3 Math.random() Code Example:

var num:Number = 10;
Math.ceil(Math.random()*num);