[thelist] Random, Not the same Random twice

Russ russ at unrealisticexpectations.com
Fri Mar 19 18:06:49 CST 2004


All,

I'm attempting to assign a random value to 3 different variables; I
don't want the variables to be able to have duplicates of the same value
(ie, they shouldn't both pull the number 2).

So far, I've got this:

<CFSET Story1 = #RandRange(1,Stories.recordCount +1)#>
<CFSET Story2 = #RandRange(1,Stories.recordCount +1)#>
<CFSET Story3 = #RandRange(1,Stories.recordCount +1)#>

And it works great, but I can--and do--get duplicates.  I'm searching
for a resource to disallow Story2 and Story3 from getting the same
variable as Story1, but I'm drawing a blank.

Can someone point me in the right direction?

Thanks,

Russ




More information about the thelist mailing list