/ Published in: ActionScript 3
Just uses the sort function to randomize an array
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var originalArray:Array = new Array("alpha", "bravo", "charlie", "delta", "echo", "foxtrot"); var shuffledArray:Array = originalArray.sort(shuffle); trace(shuffledArray); function shuffle(originalArray,shuffledArray):int { var sortNum : int = Math.round(Math.random() * 2) - 1; return sortNum; }