how to get a 50/50 chance in random generator
<p>I am trying to get a 50/50 chance of get either 1 or 2 in a random generator.</p>

<p>For example:</p>

<pre><code>Random random = new Random();
int num = random.nextInt(2)+1;
</code></pre>

<p>This code will output either a 1 or 2. </p>

<p>Let's say I run it in a loop:</p>

<pre><code>for ( int i = 0; i &lt; 100; i++ ) {
    int num = random.nextInt(2)+1 ;
}
</code></pre>

<p>How can I make the generator make an equal number for 1 and 2 in this case?</p>

<p>So I want this loop to generate 50 times of number 1 and 50 times of number 2.</p>
