Skip to content

Instantly share code, notes, and snippets.

@noyobo
Last active December 19, 2015 23:59
Show Gist options
  • Save noyobo/6037876 to your computer and use it in GitHub Desktop.
Save noyobo/6037876 to your computer and use it in GitHub Desktop.
Array.shuffle 数组乱序
if (!Array.prototype.shuffle) {
Array.prototype.shuffle = function() {
for(var j, x, i = this.length; i; j = parseInt(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x);
return this;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment