RandRange |
Description
Generates a random integer between two specified numbers. Requests for random integers that are greater than 100,000,000 result in non-random numbers, to prevent overflow during internal computations.
Returns
A random integer
Category
Mathematical functions
Function syntax

    RandRange(number1, number2)

See also
Rand, Randomize
Parameters

Parameter | Description
number1,number2 | Integer numbers less than 100,000,000

Example

    <h3>RandRange Example</h3>
    <p>RandRange returns an integer between two specified integers.
    <cfif IsDefined("FORM.myInt")>
       <p>RandRange returned:
          <cfoutput>#RandRange(FORM.myInt, FORM.myInt2)#</cfoutput>
    </cfif>

    <cfform action = "randRange.cfm">
    <p>Enter a number to seed the randomizer:
    <cfinput type = "Text" name = "MyInt" value = "1" RANGE = "1,100000000"
     message = "Please enter a value between 1 and 100,000,000"
      validate = "integer" required = "Yes">
    <cfinput type = "Text" name = "MyInt2" value = "500" RANGE = "1,100000000"
     message = "Please enter a value between 1 and 100,000,000"
      validate = "integer" required = "Yes">
    <p><input type = "Submit" name = "">
    </cfform>

number1, number2 |
Integer numbers less than 100,000,000