/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function fRandomize(vArray : Array) : void { var i : int; var j : int; for (i = 0; i < vArray.length - 1; i++) { j = i + Math.floor(Math.random() * (vArray.length - i)); if (j != i) fSwap(vArray, i, j); } } function fSwap(vArray : Array, i : uint, j : uint) : void { var t : *; t = vArray[i]; vArray[i] = vArray[j]; vArray[j] = t; }
Comments
