home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / randomize.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  942 b   |  35 lines

  1. <!--- This example shows the use of Randomize --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. Randomize Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11. <H3>Randomize Example</H3>
  12.  
  13. <P>Call Randomize to seed the random number generator. 
  14. This helps to ensure the randomness of numbers generated 
  15. by the Rand function.
  16. <CFIF IsDefined("form.myRandomInt")>
  17.     <CFIF IsNumeric(form.myRandomInt)>
  18.         <cfoutput><p><b>Seed value is #form.myRandomInt#</b></cfoutput><BR>
  19.         <CFSET r=Randomize(form.myRandomInt)>
  20.         <cfloop index="i" from="1" to="10" step="1">
  21.            <cfoutput>Next random number is #Rand()#</cfoutput><BR>
  22.         </cfloop><BR>
  23.     <CFELSE>
  24.         <P>Please enter a number.
  25.     </CFIF>
  26. </CFIF>
  27. <FORM ACTION="randomize.cfm" METHOD="POST">
  28. <P>Enter a number to seed the randomizer:
  29. <INPUT TYPE="Text" NAME="MyRandomInt">
  30. <P><INPUT TYPE="Submit" NAME="">
  31. </FORM>
  32.  
  33. </BODY>
  34. </HTML>       
  35.