Fisher-Yates shuffle algorithm in AS2:
function fisherYates(myArray:Array):Void
{
var i:Number = myArray.length;
if (i > 0)
{
while (--i)
{
var j:Number = Math.floor(Math.random() * (i + 1));
var tempi:Object = myArray[i];
var tempj:Object = myArray[j];
myArray[i] = tempj;
myArray[j] = tempi;
}
}
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com