No Description

random.js 222B

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