Created
March 14, 2014 09:27
-
-
Save azakordonets/9544686 to your computer and use it in GitHub Desktop.
Generate random int number in Java
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
/** | |
* Random generator in range | |
* | |
* @param minimum Number | |
* @param maximum Number | |
* @return randomNumber | |
*/ | |
public int randomGenerator(int minimum, int maximum) { | |
Random rn = new Random(); | |
int range = maximum - minimum + 1; | |
int randomNum = rn.nextInt(range) + minimum; | |
return randomNum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment