I get 0 and 5000 randomly (which is how I wanted it to work, a 30% chance to receive 5000) however I also get 500 which I assume is due to the fact that it's not running the function at all? I'm not really sure, I'm very new to coding.
int gamble2 (int money){
srand(time(0));
int rand();
if (rand() % 100 >= 70){
money += 4500;
}
else if (rand() % 100 < 70){
money -= 500;
}
return money;
}
main()
{
int startingmoney = 500;
int money = startingmoney;
int objective = 100000;
cout << gamble2(money) << endl;
}