Do not call srand() more than once in one program, there is no point, especially in a fast loop where time() will be the same everytime (the measure is in seconds).
I notice that the way my RNG works, having that srand() inside the for loop causes it to output the same number repeatedly. Moving it to where it should be:
Code:
srand(time(NULL));
for (i = 1; ; ++i){
random = rand() % 10;
Made a drastic difference.
This illustrates why you should not seed more than once. Every srand() call resets the generator, so if you call it like this:
Code:
for (i=0;i<10;i++) {
srand(22222);
printf("%d\n", rand());
}
You will get the exact same number 10 times. Now remember that time() will be the same for an entire second in your code.