I am needing to have this program choose between two options randomly. The program all works except that when I use this line of code:

int x= rand() % 2;

it seems that it's not random but rather follows the same pattern every time. I have searched and found things like gettickcount() but even with the headers, it wont compile. Anything that will let it randomly choose between 0 or 1 is just what I need.
Thanks!

Yes, sorry I failed to mention that. Originally I had

srand ( time(NULL) );
int x= rand() % 2;

but it seemed that rather than mixing it up during runtime it just stuck with either the 0 or 1. I wasnt sure if it was because not enough time was passing or.....?

You guessed it! I was just getting back on here to close this thread as I had found someone else with the same problem on another forum. So I just had to create another function so that yes, it only called srand() once rather than every time.
Thanks.

This question has already been answered. Start a new discussion instead.