Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save captain-woof/b606fd5d8bf3fa6b08cb6747fe6bc120 to your computer and use it in GitHub Desktop.

Select an option

Save captain-woof/b606fd5d8bf3fa6b08cb6747fe6bc120 to your computer and use it in GitHub Desktop.
#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