true or false based on probability
<p>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?</p>

<p>Generate a 'random' <code>TRUE</code> or <code>FALSE</code> depending on what probability I assigned the function. </p>

<pre><code>bool randtf(int probability) {
    if ((rand() % 100) &lt; probability)
        return true;
    else
        return false;
}
</code></pre>

<p>so if <code>randtf(63)</code> it has a 63% chance of being <code>TRUE</code>?</p>

<p>Any guidance would be much appreciated. Thanks.</p>
