Skip to content

Instantly share code, notes, and snippets.

@dayt0n
Created November 19, 2015 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dayt0n/0bbb528ee6810c68e391 to your computer and use it in GitHub Desktop.
Save dayt0n/0bbb528ee6810c68e391 to your computer and use it in GitHub Desktop.
Generate a random integer.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
srand(time(NULL));
unsigned seed = rand() % 1024;
int r;
srand(seed);
r=rand();
sleep(1);
printf("%d",r);
putchar('\n');
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment