Created
April 17, 2019 15:36
-
-
Save diogocapela/fc921b3f37842a4425df0fc7afa46528 to your computer and use it in GitHub Desktop.
Get Random Number in C
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 getRandomIntBetween(int min, int max) { | |
srand(time(NULL) * getpid() << 16); | |
int randomNumber = (rand() % max) + min; | |
return randomNumber; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment