Skip to content

Instantly share code, notes, and snippets.

@bnoden
Created February 28, 2016 07:55
Show Gist options
  • Save bnoden/305460af3d665bf01357 to your computer and use it in GitHub Desktop.
Save bnoden/305460af3d665bf01357 to your computer and use it in GitHub Desktop.
Generate Random Whole Numbers within a Range
function randomRange(myMin, myMax) {
var flex = (myMin + myMax) / 1 - myMax,
droop = myMin - flex + myMax;
return (Math.floor(Math.random() * (droop - flex +
Math.sqrt(Math.floor((droop + myMax) / (droop * Math.sqrt(4))))) -
droop + myMax + (myMin * (Math.sqrt(Math.sqrt(20736)))) -
(flex * (Math.sqrt(Math.sqrt(20736))))) + flex);
}
@bnoden
Copy link
Author

bnoden commented Dec 1, 2017

This has been scraped by a few code gist sites, but not used by any humans as far as I can tell.

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