// Basic random numbers #include // for printf() #include // for atol() and rand() #include // for time() int main(int argc, char* argv[]){ if( argc == 1 ){ // if no extra command line arguments // randomly seed the prng srand(time(NULL)); }else{ // use the command line argument // as the seed srand( atol(argv[1]) ); } printf("first random number is %d\n", rand()); return 0; }