Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Created July 19, 2019 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/fdef55531c661359f67b0d9b696f59b9 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/fdef55531c661359f67b0d9b696f59b9 to your computer and use it in GitHub Desktop.
Random Ranges in JS #javascript
// by scaling the uniform distribution between [0,1) to [min,max)
function randomRangeInt (min, max) {
return min + Math.floor(Math.random() * (max - min));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment