stopping random choose existing option
<p>In my game, when the "next-question" button is clicked, it should choose a new word in the grid for the user to spell. It does this, but the problem is that instead of going to another word, sometimes the randomization brings it back to the word it is already on. I need to make it so that it chooses any other than the one its on.</p>

<pre><code>    //Next question click event
    $('.next-question').on('click', function () {
    $('td').removeClass('highlight-problem');
    var r = rndWord;
    while (r == rndWord) {
    rndWord = Math.floor(Math.random() * (listOfWords.length));
}
    //Adds and removes nesesary classes
    $('td[data-word="' + listOfWords[rndWord].name + '"]').addClass('highlight-problem');
    $('td[data-word=' + word + ']').removeClass('wrong-letter').removeClass('wrong-word').removeClass('right-letter');
    var spellSpace = $('td[data-word="' + listOfWords[rndWord].name + '"]').hasClass('right-word');
    if (spellSpace) {
        $(".next-question").eq(($(".next-question").index($(this)) + 1) %$(".next-question").length).trigger("click");
    } else {
        $("#hintSound").attr('src', listOfWords[rndWord].audio);
        hintSound.play();
        $("#hintPic").attr('src', listOfWords[rndWord].pic);
        $('#hintPicTitle').attr('title', listOfWords[rndWord].hint);
    }
});
</code></pre>
