mh108
7/9/2018 - 6:14 PM

getRandomInt

returns random integer 1 .. max

from MDN documentation for Math.random

// return random integer 1 .. max
function getRandomInt(max) {
  return Math.floor(Math.random() * max) + 1;
}