Friday, March 27, 2009

: How do you generate random numbers within a given limit with actionscript

Question :: How do you generate random numbers within a given limit with actionscript?
Answer :public function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

No comments: