Lots of misconceptions here... That the difference between two time(NULL)
calls close to each other is small, is expected. After all, time moves only so fast. The next problem is that rand()
returns a (pseudo) random value (of varying quality): Random in this case means that you may get 33
repeatedly a few times, as long as it's not predictable. That being said, rand()
is implementation dependent, and it may very well be that your implementation uses something like an LCG, which doesn't generate good uniform random values. The only fix for that, is switching to a different rng. Since this is tagged as C++, you may want to take a look into C++11s random header and use something like their mersenne twister implementation, which is a good pseudo random number generator which produces random numbers with great quality and uniform distribution.