G'day
Now for the reason I was trying to work out what was a valid integer
and what wasn't in OBD (see my previous post about isValid()).
This code:
<cfset iMin = -2^31>
<cfset iMax = 2^31-1>
<cfoutput>randRange(#iMin#, #iMax#): #randRange(iMin, iMax)#<br /></
cfoutput>
Errors with:
The page you were executing caused an internal BlueDragon server error
Request /misc/randRange2.cfm
File Trace C:/webroots/openbd/misc/randRange2.cfm
Type Internal
Stack Trace
java.lang.IllegalArgumentException: n must be positive
at java.util.Random.nextInt(Unknown Source)
at com.naryx.tagfusion.expression.function.randomRange.rand(Unknown
Source)
at
com.naryx.tagfusion.expression.function.randomRange.execute(Unknown
Source)
at com.naryx.tagfusion.cfm.parser.CFFunctionExpression.Eval(Unknown
Source)
[etc]
Now... on CF8 & 9 there is a *different* problem with this, in that
the expression always returns -2147483648 (ie: the lowest valid
integer). I've raised this with Adobe.
On OBD if I raise the iMin value to -2^30, it stops erroring, and
starts outputting different numbers, but by no stretch are they
random: always ten-digit-long positive integers.
So there's two things here.
* The lower threshold for randRange() should be 2^31-1. Unless for
some reason OBD uses a different integer range than CF does... which'd
be fine I guess, but is there an equivalent in OBD of
createObject("java", "java.lang>integer").MIN_VALUE, so I can work out
what that lower threshold is?
* It's not behaving properly with low number in that lower threshold.
I've just notice that OBD expresses -2^30 as 1073741824 (!!). So I
guess there's some overflow going on here, which might be contributing
to things here..?
Shall I raise a bug? Two?
--
Adam
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
online manual: http://www.openbluedragon.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en