| Contents > CFML Reference > ColdFusion Functions > Randomize |
|
|
|
|
||
Seeds the ColdFusion random number generator with an integer number. Seeding the generator helps ensure that the Rand function generates highly random numbers.
A non-random decimal number, in the range 0 - 1.
Randomize(number)
Parameter |
Description |
|---|---|
number |
A number |
Call this function before calling Rand. Although this function returns a decimal number, it is not a random number.
<h3>Randomize Example</h3> <p>Call Randomize to seed the random number generator. This helps
to ensure the randomness of numbers generated by Rand. <cfif IsDefined("FORM.myRandomInt")> <cfif IsNumeric(FORM.myRandomInt)> <cfoutput><p><b>Seed value is #FORM.myRandomInt#</b> </cfoutput><br> <cfset r = Randomize(FORM.myRandomInt)> <cfloop index = "i" from = "1" to = "10" step = "1"> <cfoutput>Next random number is #Rand()#</cfoutput><br> </cfloop><br> <cfelse> <p>Please enter a number. </cfif> </cfif> <form action = "randomize.cfm"> <p>Enter a number to seed the randomizer: <input type = "Text" name = "MyRandomInt"> <p><input type = "Submit" name = ""> </form>
|
|
||
| Contents > CFML Reference > ColdFusion Functions > Randomize |
|
|
ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa61.htm
Comments
No screen name said on Nov 27, 2003 at 2:36 AM : Terry Luedtke said on Sep 21, 2004 at 2:58 PM : bizarrojack said on Jan 6, 2005 at 9:12 AM :