Skip to content

Instantly share code, notes, and snippets.

@kamicane
Created June 20, 2009 02:59
Show Gist options
  • Save kamicane/133018 to your computer and use it in GitHub Desktop.
Save kamicane/133018 to your computer and use it in GitHub Desktop.
// Array shuffle for MooTools
Array.implement({
shuffle: function(){
var i = this.length;
if (i == 0) return;
while (--i){
var j = Math.floor(Math.random() * ( i + 1 ));
var tempi = this[i];
var tempj = this[j];
this[i] = tempj;
this[j] = tempi;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment