Thanks greatly for your efforts Mark. Unfortunately, the code still produces
duplicates :-( However the code you wrote looks interesting and I've got
myself something to tease my brain for the next many hours as I try to
"understand" what your code is actually doing :-) Very cool and much
appreciated. I'll get this unique random numbers thing eventually.
Thanks again,
Karl
> From: "Marc Campeau" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Thu, 28 Mar 2002 15:15:11 -0500
> To: <[EMAIL PROTECTED]>
> Subject: RE: [CFTALKTor] RandRange question - Unique random numbers
>
> <CFSCRIPT>
> recordcount = 10;
> iTotalImages = 5;
> lstImageNames = ""; // Array holding image names
> iRandTmp = 0;
> for ( i=1; i LTE recordCount; i=i+1 ) {
> inserted = false;
> // Get an image number
> while( NOT inserted ) {
> iRandTmp = int( randRange( 1, recordCount ) ) ;
> if ( iRandTmp GT iTotalImages ) {
> iRandTmp = iRandTmp mod iTotalImages;
> lstImageNames = listAppend( lstImageNames , iRandTmp );
> inserted = true;
> }
> else if ( NOT listFind( lstImageNames, iRandTmp ) ) {
> lstImageNames = listAppend( lstImageNames , iRandTmp );
> inserted = true;
> }
> } // end while
> writeOutput( "<IMG SRC=""img#iRandTmp#"" ......><BR> " );
> } // end for
>
> </CFSCRIPT>
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: Karl Zarudny <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)