1 var arr:Array = [1,1,2,2,3,3,4,4,5,5,6,6]; 2 disorder(arr); 3 trace(arr); 4 function disorder(arr : Array):Array 5 { 6 var len:uint = arr.length; 7 var cache:*,ti:uint; 8 for (var i : uint = 0; i < len; i++) 9 { 10 ti = int(Math.random() * len); 11 cache = arr[i]; 12 arr[i] = arr[ti]; 13 arr[ti] = cache; 14 } 15 while (--i >= 0) 16 { 17 ti = int(Math.random() * len); 18 cache = arr[i]; 19 arr[i] = arr[ti]; 20 arr[ti] = cache; 21 } 22 return arr; 23 }