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 On 7/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I need to generate 1000, unique 8 digit numbers. I'm looking for a function > that will do this. > Rand generates in the range of 0 - 1. RandRange would work, but how do I > assure that there > aren't any duplicates. I'm outputing this data from a query to a xls. > > Thanks > > D > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284593 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4