Preventing the same sum from appearing
<p>In my game, sums are created randomly by the program and displayed at the top. The user then has to click on the correct number to answer the sum. At the moment there is no way for me to make sure that a sum that requires the same answer as the previous one is chosen. How can I prevent this from happening so that the user is not always clicking the same answer.</p>

<p>Here are the functions that generate the sums..</p>

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

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

function createSum() {
    total = Math.ceil(Math.random() * 10);
    if (Math.random() &gt; 0.5) {
    createTakeSum(total);
} else {
    createPlusSum(total)
}
</code></pre>

<p>Fiddle: <a href="http://jsfiddle.net/xgDZ4/3/" rel="nofollow">http://jsfiddle.net/xgDZ4/3/</a></p>
