Skip to content

Instantly share code, notes, and snippets.

@Margino
Created August 30, 2022 08:55
Show Gist options
  • Select an option

  • Save Margino/dcb0de89ff5ab87585009aa90cac2333 to your computer and use it in GitHub Desktop.

Select an option

Save Margino/dcb0de89ff5ab87585009aa90cac2333 to your computer and use it in GitHub Desktop.
Getting a random number between two values
const getRandomInt = (min = 0, max = 1000) => {
const random = (Math.random() * (max + 1 - min)) + min
return Math.floor(random)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment