Javascript 洗牌算法,打乱数组,随机获取元素
摘要:
//利用洗牌算法Array.prototype.shuffle=function(){ var i,t,m=this.length; while(m){ i=Math.floor(Math.random()*m--); t=this[m]; this[m]=this[i]; this[i]=t; } 阅读全文
posted @ 2017-05-02 18:11 _chuck 阅读(233) 评论(0) 推荐(0) 编辑