ulfben

Get random number between min and max

Dec 7th, 2015
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Returns a random number between min (inclusive) and max (exclusive)
  2. function getRandom(min:Number, max:Number):Number {
  3.     return Math.random() * (max - min) + min;
  4. }
  5.  
  6. //Returns a random integer between min (inclusive) and max (inclusive)
  7. function getRandomInt(min, max):int {
  8.     return Math.floor(Math.random() * (max - min + 1)) + min;
  9. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×