How can i shuffle an array in JavaScript

function shuffle(o){ //v1.0 for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o;};

alert(shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12]));