Every time you generate a new random number go through the array and see if any match the new number if so generate a new one and check again, if not add it to the array. With only 10 numbers in the array it would check very fast so you wouldn't be taking a performance hit.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eduardo Barbosa Sent: Monday, July 28, 2008 4:43 PM To: Flashcoders mailing list Subject: [Flashcoders] Random numbers list Hi all! What I am trying to figure out is this: How to generate a sequence of random numbers where the newest is always different from all the previous? I need to continuosly rewrite an array of 10 random numbers in such a way that at any given time they are all different. Let's say that my range is 0 to 100 it starts with random numbers, all different: {3, 34, 12, 69, 6, 44, 31, 90, 88, 23} at a set interval some values are replaced by new ones so there are never two equal numbers, so, after 2 seconds it may look like this: {3, 66, 12, 79, 6, 44, 10, 81, 88, 23} Any ideas? Thanks :) Eduardo _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders