Implementing Fisher–Yates shuffle loop not working
<p>I am trying to implement the Fisher–Yates shuffle but when I test this code just with alert, it doesn't seem to loop, stops after first time I think.</p>

<pre><code>function scrambleWord() {
    var letterArray = currentWord.split("");
    var m = letterArray.length, t, i;
    while (m) {
        x = Math.floor(Math.random() * m--);
        t = letterArray[m];
        letterArray[m] = array[i];
        array[i] = t;
    }
    scrambledWord = letterArray.join("");
}
</code></pre>
