This is my smallest post, but extremely important. In C or C++, before generating random numbers we often end up doing
So every time you run the program, you get new set of random numbers. Do you see the problem?
The problem is that the output is not reproducible. This is a big issue if you want to debug a particular test case.
But for some purposes, you just don’t need to reproduce output, in that case go ahead and use it. In some of my (blog) programs I am guilty of using srand(time(0)), please disregard it.