Hey guys, I'm trying to create a simple game that is a duel between a user and dragon. The idea stemmed from the codecademy challenge and I decided to add a hit or miss chance as well as a health factor. When I run the code, it runs (Yay! Woo!) unfortunately, the program returns the same damage values for the same iteration of loops. If you run the code, on the first cycle, it always misses the attack. On the second it is always misses and you take damage, on the third, the user deals 39 damage, etc. It is ALWAYS the same and I'm not sure why. Can someone give me a hint or tell me why it's always looping the same per program execution?
It appears you forgot to set the random number seed. At the beginning of your main function, try including srand(time(NULL));, before you declare your variables. Make sure not to put this command in a loop or a function, and that it is only executed once, or your numbers will no longer be random.