[Solved] C++ randomized number always same even with time(0) as seed [duplicate]
You’re reseeding the pseudo-random sequence with the same seed before each call to rand, since the value returned by time only changes once a second. That causes you to get the same result each time. Only call srand once, at the start of the program. Better still, look at the C++11 <random> library, which has … Read more