Custom Random number within range


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



Copy this code and paste it in your HTML
  1. trace( randRange( 1, 10 ));
  2.  
  3.  
  4. function randRange( minNum:Number, maxNum:Number ) : Number
  5. {
  6. return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.