Barney, I love the 1XYZ-N technique for the length constraint That's damn brilliant!
...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -----Original Message----- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 25, 2007 6:01 PM To: CF-Talk Subject: Re: Generate Random Number 1000 - No Duplicates I haven't tested this (just wrote it in the email), but it should be close: function getRandomNumberArray(length, count) { var min = "1" + repeatString("0", length - 1); var max = repeatString("9", length); var uniquer = structNew(); var result = arrayNew(1); var num = ""; while (arrayLen(result) LT count) { num = randRange(min, max); if (NOT structKeyExists(uniquer, num)) { uniquer[num] = ""; arrayAppend(result, num); } } return result; } cheers, barneyb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284596 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4