Im trying to make a basic game just to test my skills. I googled a function that would generate a random number in C and it seemed to work... but when trying to call the function to generate random stats for my game it seems to fail me... It spits out numbers that are either ridiculously large or ridiculously small... or just equal to zero. Heres my code, can anyone help me with this?
for level it should be 1 to 3. For attack it should be 45 to 150 (in the code it says 1501 which was a mistake) for defense it should be 45 to 150. for health it should be 100 to 500. and for starting xp it should be 50 to 1000.
Haha, well I have to agree with you there. But this is really just to test what i have learned from a tutorial series I'm watching by the guys at wibit.net. They seem to be pretty set on making all there students learn C before anything else, and being someone who is fairly new I'm not really one to object. I have worked with some OO programing languages and know this would be much easier if i were to be using objects but oh well, I guess I gotta work with what I know for now and upgrade later.
And I just entered the code the way you suggested and got the same output... here is how the IF statement goes now: