How to generate a random number in C++?
The most fundamental problem of your test application is that you call srand once and then call rand one time and exit. The whole point of srand function is to initialize the sequence of pseudo-random numbers with a random seed. It means that if you pass the same value to srand in two different applications (with the same srand/rand implementation) then you will get exactly the same sequence of rand() values read after … Read more