Skip to content

Instantly share code, notes, and snippets.

@okovalov
Created February 25, 2019 21:33
Show Gist options
  • Save okovalov/4122c7bf8d42575580280a09a71edd56 to your computer and use it in GitHub Desktop.
Save okovalov/4122c7bf8d42575580280a09a71edd56 to your computer and use it in GitHub Desktop.
/**
* A random integer between given min and max
*/
const getRandomNumber = (min = 1, max = 10) => Math.floor(Math.random() * (max - min + 1)) + min
const min = 10
const max = 15
for (let i = 1; i <= 10; i++) {
console.log(`Random number between ${min} and ${max} = ${getRandomNumber(min, max)}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment