>>Anyone know how ranrange() calculates it result? I am seeing some not so
>>random results.

Most random number generators work as follows (and I believe CF is no
exception):

They are given a seed number between 0 and 1
An algorithm (call it Algorithm A) is run on that seed to produce random
number 1
Algorithm A is run on random number 1 to produce random number 2
Algorithm A is run on random number 2 to produce random number 3

and so on. This means of course that for the same seed, you will get the
same sequence of "random" numbers. Hence in ColdFusion (as in most other
languages) you have to run the Randomize function first in order to generate
a unique seed. If you don't, you will see the same sequence reappear.

I don't know what algorithm CF uses to generate random numbers, but I do
know it risks overflow when producing numbers over 100,000,000 with
randRange. Hence, one of the limitations of RandRange is that for ranges
over 100,000,000 it will produce non-random sequences.

Mike.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to