• Advertisement
Sign in to follow this  

Rand is the same every time.

This topic is 1808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You roll arrayChooser once at program start, but then you don't ever re-roll it as you move, so whatever the event is chosen to be at program start is what it will always be as you play.

Share this post


Link to post
Share on other sites
Stunning... the usual answer (without looking at your code) would be: "Beginner error: you forgot to call srand or you are calling srand with the same value every time before calling rand". But, your code actually looks perfectly correct...

Share this post


Link to post
Share on other sites

FleBlanc is correct. The variable arrayChooser never changes because you only call rand() once before the loop.

Share this post


Link to post
Share on other sites

How could I fix this?? make a loop before the main loop that changed arrayChooser every time?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement