Make sure you're doing
srand ( time(NULL) );
while(condition) {
int x = rand();
cout << x << endl;
}
and not
while(condition) {
srand ( time(NULL) );
int x = rand();
cout << x << endl;
}
The first way the seed is changed every iteration. The second way you are performing the random function on a very similar seed each iteration (because time doesn't change much).