home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / randomize.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  897 b   |  34 lines

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