Last active
December 13, 2015 18:38
-
-
Save ejknapp/4956877 to your computer and use it in GitHub Desktop.
Random number between two numbers.
This file contains hidden or 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
- (int)randomNumberFrom:(int)first to:(int)second | |
{ | |
int difference = second - first; | |
int randomValue = arc4random() % (difference + 1); | |
return randomValue + first; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are correct sir and the code has been corrected.