faqts : Computers : Programming : Languages : ColdFusion

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 6 people (67%) answered Yes
Recently 4 of 6 people (67%) answered Yes

Entry

Where can I get ALGORITHMS that can randomize numbers in coldfusion?

Apr 13th, 2004 06:32
Nathan Stanford, zor k, http://www.cftipsplus.com


Outputs number from 1 - 100
<!--- Get the Current Seconds --->
<cfset numgen=timeformat(now(),'ss')>
<!--- Randomize the Randmon Generator --->
<cfset dummy=randomize(numgen)>
<!--- Random Number between 1 and 100 --->
<cfset mynr=randRange(1,100)>
<!--- 
Format the output (note there are 3 underscores for the three digits 
possible output 
 --->
<cfset mynr=#NumberFormat("#mynr#",'___')#>
<!--- display the new random number --->
<cfoutput>#mynr#</cfoutput>
Hope this helps answer your question.