[thelist] Random, Not the same Random twice

Russ russ at unrealisticexpectations.com
Sat Mar 20 12:27:07 CST 2004


I've attempted a couple of things, one being DeleteClientVariable, and
that's not working.

In the interim, I've basically built a CFIF that says if Story1 IS
Story2, get a new random number, but that only repeats itself once.  The
success ratio is dramatically higher, but it's still not what I need.

Is there an easier way to this? Certainly it's just my lack of
experience that's causing me issue here!  I hope!

> find the fonction in Cold Fusion that allows you to delete a record,
> here's a pseudo code :
> <CFSET Story1 = #RandRange(1,Stories.recordCount +1)#>
> <CFSET Stories.DeleteRecordByValue(Story1) >
> <CFSET Story2 = #RandRange(1,Stories.recordCount +1)#>
> <CFSET Stories.DeleteRecordByValue(Story2) >
> <CFSET Story3 = #RandRange(1,Stories.recordCount +1)#>
> 
> each time you select a random value, you delete it from your array
> Stories.
> 
> 
> -----Original Message-----
> 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?
> 




More information about the thelist mailing list