User Guide

RandRange 805
RandRange
Description
Generates a pseudo-random integer in the range between two specified numbers.
Returns
A pseudo-random integer.
Category
Mathematical functions, Security functions
Function syntax
RandRange(number1, number2[, algorithm])
History
ColdFusion MX 7: Added the algorithm parameter.
See also
Rand
, Randomize
Parameters
Usage
Very large positive or negative values for the number1 and number2 parameters might result in
poor randomness in the results. To prevent this problem, do not specify numbers outside the
range -1,000,000,000 – 1,000,000,000.
ColdFusion MX 7 uses the Java Cryptography Extension (JCE) and installs a Sun Java 1.4.2
runtime that includes the Sun JCE default security provider. This provider includes the
algorithms listed in the Parameters section (except the default algorithm). The JCE framework
includes facilities for using other provider implementations; however, Macromedia cannot
provide technical support for third-party security providers.
Parameter Description
number1, number2 Integer numbers. If the numbers are not in the range -2,147,483,648
2,147,483,647, ColdFusion generates an error.
algorithm (Optional) The algorithm to use to generated the random number.
ColdFusion MX installs a cryptography library with the following algorithms:
CFMX_COMPAT: the algorithm used in ColdFusion MX (default).
SHA1PRNG: generates a number using the Sun Java SHA1PRNG
algorithm. This algorithm provides greater randomness than the default
algorithm
IBMSecureRandom: for IBM WebSphere (IBM JVM does not support
the SHA1PRNG algorithm.)