Im working with a loop and a few if statements within the loop. I'm using rand() % 100+1 to generate a random number, and from that number I'm having different outcomes. If the same outcome happens twice though I want something different to happen. How would I get this to work?
1 2 3 4 5 6 7 8 9 10 11 12
int m = 10
int n = 10
while()
{
int chance;
m--;
chance = rand() % 100 + 1;
if(chance >= 50)
n++;
if(chance < 50)
n--;
}
So if n-- occurs twice in a row during the loop, I want n++ to occur no matter what chance equals. And after that it goes back to the normal chance.