@Mark - Thanks for the suggestion @Steven - Thanks for the code! This does work better than the others.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Monday, August 13, 2007 3:16 PM To: [email protected] Subject: Re: [Flashcoders] array copy with random order 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; } } } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Hawley Sent: Monday, August 13, 2007 2:45 PM To: [email protected] Subject: Re: [Flashcoders] array copy with random order Just look up "Fisher-Yates shuffle" and use it. It's better than any number of home-rolled randomizers. _______________________________________________ [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

