Function: Random value between two numbers

/ Published in: ActionScript
Save to your folder(s)

Small function that returns a random rounded value between two given numbers.

Copy this code and paste it in your HTML
  1. public function getRandom(_min, _max):Number{
  2. var tNumber:Number;
  3. tNumber = Math.round(Math.random()*(_max-_min))+_min;
  4. return tNumber;
  5. } // END getRandom()

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.