Javascript Array shuffled()
shuffled()
Array.prototype.shuffled = function(){ var copy = this.slice() var result = []//from w w w .j a va 2 s . c om while (copy.length > 0){ result.push(copy.popRandomElement()) } return result }