random.js 268 B

1234567891011121314
  1. define(function () {
  2. // Return a random integer between `min` and `max` (inclusive).
  3. function random(min, max) {
  4. if (max == null) {
  5. max = min;
  6. min = 0;
  7. }
  8. return min + Math.floor(Math.random() * (max - min + 1));
  9. }
  10. return random;
  11. });