PHP has a function shuffle () that can easily disrupt arrays. This function is used in many cases, but the javascript array does not have this method. It doesn't matter. You can expand one, do it yourself.
<Script type = "text/javascript"> // <! [CDATA [var shuffle = function (v) {for (var j, x, I = v. length; I; j = parseInt (Math. random () * I), x = v [-- I], v [I] = v [j], v [j] = x); return v ;}; var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; document. write ("A =",. join (","), "<br> shuffle (A) =", shuffle (a); 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 ;};} document. write ("<br>. shuffle () = ",. shuffle (); //]> script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Refresh the page to view the random sorting effect.