How to Generate Random IP Address using Coldfusion (CFML)

By | July 28, 2015

Our dev team needed random IP Address for dummy data, here is how I accomplish generating random IP Address.

The function used to accomplish this was: RandRange

RandRange(number1, number2[, algorithm])
The algorithm to use to generate the random number. ColdFusion installs a cryptography library with the following algorithms:
CFMX_COMPAT: the algorithm used in ColdFusion (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.)