numbers = {};
while (structCount(numbers) LT 6) {
  numbers[randRange(1, 20)] = "";
}
numbers = structKeyList(numbers);

On Sun, Dec 14, 2008 at 3:45 PM, Don L <[email protected]> wrote:
> Man, I'm not having a good time with a seemingly simple problem, that is, to 
> generte a bunch of (say, 6) of unique numbers out of a range.  Say, the range 
> is 20.
> My current code technique is mainly to use a 'pool of numbers, each less than 
> 20', if found, try generate a number again (and here's the potential problem, 
> that is, you don't know if the newly generated number would be a member of 
> 'pool of numbers', so, one would have to run a check again...  So, for now, 
> the code sometime produce one or even two duplication numbers.  Do you have a 
> better way?
>
> Thanks.
>
> Don
> Chunshen Li
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316747
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to