Skip to content

Instantly share code, notes, and snippets.

@Klerith
Last active October 4, 2022 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Klerith/39696c051e8be4402f1e to your computer and use it in GitHub Desktop.
Save Klerith/39696c051e8be4402f1e to your computer and use it in GitHub Desktop.
JavaScript: getRandomBetween
/**
* Get a random number between two numbers
* @param {integer} min
* @param {integer} max
* @return {integer}
*/
function getRandomBetween(min, max) {
return Math.random() * (max - min) + min;
}
@Klerith
Copy link
Author

Klerith commented Oct 8, 2014

Easy way to get a random number between 2 numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment