In a little mini game i have made i use some rand() % blabla to check if you hit an enemy or not and for some other things aswell. But each time i run the program the same things happen in the same order.
Why?
In a little mini game i have made i use some rand() % blabla to check if you hit an enemy or not and for some other things aswell. But each time i run the program the same things happen in the same order.
Why?
You neet to call srand() to seed the random number sequence.
Refer to FAQs
put randomize();
before the main body/loop..
-
heyy!! you didn't thank me??
-
ThisPost = ignore();
Last edited by ErionD; 03-14-2002 at 05:28 AM.
Hehe =)
Well first of all you posted while i was writing the thank you reply so i didnt know that you had replied.
Second you didn't provide such a good explanation.
What happens if i put randomize() before the main()?
>>What happens if i put randomize() before the main()?
Likely that your code will not compile.........