数组打乱顺序

<script>
var srcArray = [1,2,3,4,5,6,7,];
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;
    };
srcArray.shuffle();

</script>


 

原文地址:https://www.cnblogs.com/jqy518/p/3032265.html