function randomRange(max:Number, min:Number = 0):Number
{
return Math.round(Math.random() * (max - min)) + min;
}
trace(randomRange(5)); //Outputs number between 0 and 5
trace(randomRange(10,1)); //Outputs number between 1 and 10
Welcome to my actionscript snippet library!
Actionscript Snips is a small repository of actionscript code that aims to save developers and designers time when developing a website.
Generate Random Number
Posted by
admin
on Sunday, July 19, 2009
Labels:
Math
0 comments:
Post a Comment