Created
January 28, 2021 19:54
-
-
Save captain-woof/b606fd5d8bf3fa6b08cb6747fe6bc120 to your computer and use it in GitHub Desktop.
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
| #include<stdio.h> | |
| #include<time.h> | |
| /* gcc -m32 -o sequence-generator sequence-generator.c */ | |
| /* Usage: ./sequence-generator [unix-time] */ | |
| int main(int argc, char* argv[]){ | |
| time_t seed; | |
| if(argc == 1){ | |
| seed = time(0); | |
| }else if(argc == 2){ | |
| seed = strtol(argv[1],NULL,10); | |
| }else{ | |
| printf("Usage: %s [unix-time]\n",argv[0]); | |
| return 0; | |
| } | |
| unsigned int random; | |
| srand(seed); | |
| for(int i=1; i<=30; i++){ | |
| random = rand() & 15; | |
| printf("%u ",random); | |
| } | |
| puts(""); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment