Tömb elemeinek összekeverése:
Array.prototype.shuffle = function () {
var result = [];
while (this.length) {
result.push(this.splice(Math.round(Math.random() * this.length - 1), 1)[0]);
}
return result;
};
var result = [];
while (this.length) {
result.push(this.splice(Math.round(Math.random() * this.length - 1), 1)[0]);
}
return result;
};