Hi.
I am experience recursive random number. It seems that only happens when rand() is in a loop.
For example:
--------------------------------------
srand(time(0));
int tempNUM = 0;
for (int i = 0; i < 1000; ++i)
{
tempNUM = 1 + rand() %9999999;
cout << tempNUM + 1;
}
--------------------------------------
In a program I am working on with a similar code to the one above, the program generates duplicates random numbers. It seems I have to *wait* one second clock until it generates a something new. Does that have something to do with time(0)?
I would like something that can generate a completely random number almost instantaneously even when it is in a for loop like the one above.
Thanks,
Kuphryn