Randomizing the Elements of an Array
package{ import flash.display.Sprite; public class Main extends Sprite{ public function Main(){ function randomSort(elementA:Object, elementB:Object):Number { return Math.random( ) - .5 } var numbers:Array = new Array( ); for(var i:int=0;i<20;i++) { numbers[i] = i; } numbers.sort(randomSort); for(var i:int=0;i<numbers.length;i++) { trace(numbers[i]); } } } }