> I have this code:
> <cfset pass = randrange(1736483927,9039930393)>
>
> It returned this number:
> 1430463369
>
> Shouldn't the number returned always be in the range specified? Is
> there a limit as to the size of the number this works on or something?
Integers in CF are limited to 32 bit numbers (thanks to M. Dinowitz for his
FA article on this), which means that the largest integer value that CF
understands is 2,147,483,647. This is a bit smaller than 9,039,930,393. My
guess is that the large number you're passing to randRange() is causing a
bit of internal confusion.
I wrote a little test. I ran a loop 1000 times, each iteration generating a
random number using the randRange() parameters you mentioned above. On 5
separate page loads, ALL 1000 numbers were less than 1,736,483,927. If I
dropped the second parameter to a value within the allowed range, then
randRange() performed as expected.
Regards,
Seth Petry-Johnson
Argo Enterprise and Associates
2,147,483,648 and 2,147,483,647
1,736,483,927
9,039,930,393
I remember reading somewhere that CF had
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.