Array.prototype.shuffle = function() { var rand = function() {return Math.floor(Math.random()*3);}; return this.sort(rand); } a = [1,2,3,4,5,6,7,8,9]; a.shuffle(); trace(a);