Last active
October 4, 2022 05:59
-
-
Save Klerith/39696c051e8be4402f1e to your computer and use it in GitHub Desktop.
JavaScript: getRandomBetween
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easy way to get a random number between 2 numbers