[Solved] Math.random() and Math.floor() why are they used together? [closed]


// Returns a random integer between min and max
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

From Mozilla Developer Network

1

solved Math.random() and Math.floor() why are they used together? [closed]