gabwebdesign
10/12/2017 - 3:17 PM

Shuffle Random from an Array

Shuffle Random from an Array

function shuffle(a) {
    var j, x, i;
    for (i = a.length; i; i--) {
        j = Math.floor(Math.random() * i);
        x = a[i - 1];
        a[i - 1] = a[j];
        a[j] = x;
    }
}

shuffle(_array);