Created
June 20, 2009 02:59
-
-
Save kamicane/133018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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