time_t seconds = time(NULL); //make sure this is declared at the beginning of the block
srand(seconds);
int a = rand();
If you want to generate the same set of random numbers again and again then seed srand with the same number instead of seconds - ideally pass this as a command line argument or a define at the top of your code.
Comment