jQuery - choosing sum at random
<p>I am creating a "whack-a-mole" style game for primary school children where they have to click on the correct number in correspondence to the sum given. </p>

<p>At the moment the program is generating addition sums like this.</p>

<pre><code>function createPlusSum(total) {
    console.log(total)
    var int1 = Math.ceil(Math.random() * total);
    var int2 = total - int1;
    $('#target').html(int1 + ' + ' + int2 + ' = ?');
}   
</code></pre>

<p>I have done this again for subtraction and it works, but I don't know where to go from here in regards to randomizing whether an addition or subtraction question is produced. Here is the function to produce a subtraction question.</p>

<pre><code>function createTakeSum(total) {
    console.log(total)
    var int1 = Math.ceil(Math.random() * total);
    var int2 = total + int1;
    $('#target').html(int2 + ' - ' + int1 + ' = ?');
}
</code></pre>

<p>I use this to create the addition sums</p>

<pre><code>createPlusSum(total);
</code></pre>

<p>How would I say I want </p>

<pre><code>createPlusSum(total);
</code></pre>

<p>or </p>

<pre><code>createTakeSum(total);
</code></pre>
