Skip to content

Instantly share code, notes, and snippets.

@diogocapela

diogocapela/random.c

Created Apr 17, 2019
Embed
What would you like to do?
Get Random Number in C
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