so i am trying to produce a simple conole game, the high or low game that im sure most of you have seen before. problem is, when i use the rand() function it produces 8 every time, rather than producing a random number. here is the code:
Well, this is my understanding of it:
No matter how many times you start your program, the default "seed value" for rand() is invariably the same. If the seed value stays the same, then so will your sequences of random numbers.
This is why you need to use srand()- it changes the seed value. srand(time(NULL)) means that you're changing the seed to the current time. That way, your seed doesn't stay the same- its value will change depending upon the time.