-
-
Save ItsNathanG/c2b532d813abfa5c960045bfb2f7a9a6 to your computer and use it in GitHub Desktop.
%javascript_randomintbetween_<min>,<max>%
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
var min = 1; | |
var max = 25; | |
function randomInteger() { | |
if (args.length == 2) { | |
min = args[0]; | |
max = args[1]; | |
} | |
var random = Math.random() * (max - min); | |
random += min; | |
return Math.floor(random); | |
} | |
randomInteger(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment