Posted By

GeorgeCross on 02/03/12


Tagged

randomminmax


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

toccoo


Random Number Between Max and Min


 / Published in: ActionScript 3
 

Functions that returns a number between min & max, as integer or decimal.

  1. public function getRandInt(_min:Number, _max:Number):int
  2. {
  3. return _min + Math.round(Math.random()*(_max - _min));
  4. }
  5.  
  6. public function getRandNum(_min:Number, _max:Number):Number
  7. {
  8. return _min +Math.random()*(_max - _min);
  9. }

Report this snippet  

You need to login to post a comment.