Les,

Forget what you've heard about randrange not really being random.  The following piece 
of code GUARANTEES that the number WILL be random.


<!-- begin  -->

<cfapplication name="randrange" clientmanagement="Yes" sessionmanagement="Yes" 
setclientcookies="Yes" clientstorage="Registry">

<cfparam name="session.randrangelist" default="">

<cfset newnum = RandRange(1,7)>

<cfloop condition="session.randrangelist contains newnum">
        <cfset newnum = RandRange(1,7)>
</cfloop>

<cfset session.randrangelist = "#ListAppend(session.randrangelist, newnum)#">

<cfoutput>
List: #session.randrangelist#<br>
Current Random Number: #newnum#
</cfoutput>

<cfif ListLen(session.randrangelist) gt 6>
        <cfset session.randrangelist = "">
</cfif>
<!-- end  -->

--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Efax.com Fax: (801) 730-7289
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net 
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------


> -----Original Message-----
> From: Les Mizzell [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 19, 2000 9:14 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CF-Talk] Random Images-Resources for Information?
> 
> 
> Well, in the process of trying to further understand the random image
> question, I've haven't been able to find much information on random
> functions at all.
> 
> "Mastering Cold Fusion 4" doesn't even mention it
> "Cold Fusion 4.0" Web Application Construction Kit (Forta) mentions the
> tags, but doesn't really give any insight into the use
> Nothing on the Allaire site except the product documentation
> 
> ....anybody want to point me towards a good source?
> Why isn't "randrange(1,7)" really all that random?
> 
> Les Mizzell
> ***********
> Some people say I'm too apathetic.
> But why should I care?
> 
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
> _talk or send a message to [EMAIL PROTECTED] with 
> 'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message 
to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to