2010-09-21, 05:10 PM
ahaha, very cute problem with your rand function
Your code runs so blindingly fast in C that all of it completes in less than a second. So you're seeding the PRNG with the same number for every function call. Call srand() in the main function before you call your own rand() wrapper.
Code:
int random()
{
int number;
[b]srand ( time(NULL) );[/b] // <--- THIS IS THE PROBLEM
number=(rand()%11);
return (number);
}Your code runs so blindingly fast in C that all of it completes in less than a second. So you're seeding the PRNG with the same number for every function call. Call srand() in the main function before you call your own rand() wrapper.
