So I am a beginner programmer learning about to program, and I have a question in particular about random numbers. I am basing me code of the book for my school. After reading it, the code tells me I should do the code like this. The problem with this is that every time I compile it, it just does not seem random to me and it goes up by 3 every time.
Then after specifically following me book that is required for my course, I decided to do this followed by what the book told me. It still goes up by 3 and does not seem very random to me!
Then after countless of minutes, I tried to play around with it and I got the solution for true randomness, but I have no idea why it works. I am literally defining it twice, but in the book it goes it once. Thank you all for reading and hope to get fast responses! :)
std::rand() is usually a poor quality random number generator. When the program is run repeatedly, the value returned by time(0); tends to go up in predictable increments, and this may be reflected in the result of std::rand()