You can reseed the random number generator with the Randomize() function, 
but that may not be your problem.

<CFSET random_number=RandRange(1, 10)>
<CFOUTPUT>
#random_number#
#random_number#
#random_number#
</CFOUTPUT>

Here you set a single variable to a random value, then you output it on 
the page three times.  The variable's value isn't going to change each 
time.  If you made "random_numer" a user defined function, then it may do 
what you're looking for.  Or create three different variables and set each 
one using RandRange().


----- Original Message ----- 
From: "Chris McCarthy" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Thursday, March 31, 2005 5:10 PM
Subject: Question on randomizing multiple times on the same page


> Hi gurus,
>
> Currently I've setup a variable like so:
>
> <CFSET random_number=RandRange(1, 10)>
>
> Now, when I call it in output:
>
> <CFOUTPUT>
> #random_number#
> </CFOUTPUT>
>
> It works fine and generates a random number (i.e. 5).  But when I list 
> it multiple times:
>
> <CFOUTPUT>
> #random_number#
> #random_number#
> #random_number#
> </CFOUTPUT>
>
> It just generates the same seeded number (i.e. 5 5 5)
>
> How do I get RandRange to refresh itself each time I call it on the same 
> page?  I don't want to have to invoke a page refresh to get a new number 
> each time.  Thanks! :)
>
> -Chris
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201110
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to