var anArray:Array = [1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4];
anArray=shuffleArray(anArray);
function shuffleArray(arr:Array):Array{
var arr2:Array = [];
while (arr.length > 0){
arr2.push(gendersArray.splice(Math.round(Math.random() * (arr.length - 1)), 1)[0]);
}
return arr2;
}
Monday, October 11, 2010
AS3 Shuffle Array
This reorders the elements of an array into a random order.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment