Created
October 29, 2013 13:17
-
-
Save Kyle-Falconer/7214459 to your computer and use it in GitHub Desktop.
A function which returns a random int with the range [minVal, maxVal]. Code taken from ["Generating random numbers in a range with Java" on StackOverflow](http://stackoverflow.com/a/363732/940217)
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
public static int randRange(int minVal, int maxVal){ | |
return minVal + (int)(Math.random() * ((maxVal - minVal) + 1)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment