Here is the sample code to shuffle the contents of an array

[cc lang=”actionscript3″]// Here is a simple function for randomizing the array function randomsort(a, b) { return Math.random()>.5 ? -1 : 1; } //usage example var arr = [1, 2, 3, 4, 5]; arr.sort(randomsort); trace(arr); //traces 4,3,1,5,2

[/cc]