Hi again,
I know that if I want to get different random values I should use srand() before using rand(), my questions are:
1) Why using srand() inside a loop will produce the same results?
2) Why rand() (without srand) always return the same value, what seed does it use??Code:for (i=0;i<20;++i) { srand(time(NULL)); printf("%d\n",rand()%((10)+1)); }
Thank you very much