数组乱序
Array.prototype.shuffle = function () {
var input = this;
for (var i = input.length - 1; i >= 0; i--) {
var randomIndex = Math.floor(Math.random() * (i + 1));
var itemIndex = input[randomIndex];
input[randomIndex] = input[i];
input[i] = itemIndex
}
网友评论