Skip to content

Instantly share code, notes, and snippets.

@bockoblur
Created April 11, 2023 07:22
Show Gist options
  • Save bockoblur/5420f0cca240b744045ab65de3d49412 to your computer and use it in GitHub Desktop.
Save bockoblur/5420f0cca240b744045ab65de3d49412 to your computer and use it in GitHub Desktop.
const getRandomInt = (min = 0, max = 1) => {
min = Math.ceil(min);
max = Math.floor(max);
// The maximum is exclusive and the minimum is inclusive
return Math.floor(Math.random() * (max - min) + min);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment