Just read an interesting article about array shuffling from DaveOnCode.
Array.shuffle(), in reality doesn't exist in Flash's AS3, thus it's a pain in the ass for us, fellow moderate-level AS3 programmer.
His script here,
var arr2:Array = [];
while (arr.length > 0) { arr2.push(arr.splice(Math.round(Math.random() * (arr.length - 1)), 1)[0]);}
"Tells" the AS3 to execute a function which shuffle an Array of stuff into another new Array.
Read more about his explanation of this function here: Array.shuffle().
No comments:
Post a Comment