Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
Forked from kamicane/Array.Shuffle.js
Created November 20, 2009 01:59
Show Gist options
  • Save sebmarkbage/239218 to your computer and use it in GitHub Desktop.
Save sebmarkbage/239218 to your computer and use it in GitHub Desktop.
// Array shuffle for MooTools
Array.implement({
shuffle: function(){
for (var i = this.length; i && --i;){
var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
this[i] = this[r];
this[r] = temp;
}
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment