i'm getting a bit confused with operators and there use with random generation. I guess i'm just asking does this code do what I want it to?
Generate a 'random' TRUE or FALSE depending on what probability I assigned the function.
bool randtf(int probability) {
if ((rand() % 100) < probability)
return true;
else
return false;
}
so if randtf(63) it has a 63% chance of being TRUE?
Any guidance would be much appreciated. Thanks.