Skip to content

Instantly share code, notes, and snippets.

@illuzor
Last active May 12, 2017 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illuzor/fdce7effbbb00fba3cd90ec51b5d5c20 to your computer and use it in GitHub Desktop.
Save illuzor/fdce7effbbb00fba3cd90ec51b5d5c20 to your computer and use it in GitHub Desktop.
randomInt.as
package {
/**
*
* Генератор (псевдо)случайного целого числа в заданном диапазоне.
*
* @param minNum Минимальное значение.
* @param maxNum Максимальное значение.
* @return Сгенерированное число
*/
public function randomInt(minNum:Number, maxNum:Number):Number {
return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment