書籍:
Array.prototype.shuffle = function() { var i = this.length; while(i){ var j = Math.floor(Math.random()*i); var t = this[--i]; this[i] = this[j]; this[j] = t; } return this; } a = [1,2,3,4,5]; a.shuffle() // 3,1,5,2,4 a // 3,1,5,2,4
PukiWiki 1.5.3 © 2001-2020 PukiWiki Development Team. Powered by PHP 7.4.33. HTML convert time: 0.049 sec.