Javascript Array toRealignedArray()
Array.prototype.toRealignedArray=function(){//returns a randomly shuffled array var clone=this.slice(); for(i=clone.length-1,tmp=clone[i],target=0;i;tmp=clone[--i]){ clone[i]=clone[(target=Math.floor(Math.random()*i))]; clone[target]=tmp;//from ww w. ja va 2 s . c om } return clone; };