My favorites | Sign in
Project Logo
       
New issue | Search
for
| Advanced search | Search tips
Issue 39: randrange errors when using range > 2,147,483,647
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by d1rtym0nk3y, Aug 12, 2008
Describe the error with as much detail as possible so that it may be
reproduced easily.

randrange throws an error when the difference between the min and max
values is >= 2,147,483,647
On CF8 and Railo2, the code does not throw an error, but the value returned
is negative. 

Provide a code snippet that demonstrates the issue.

<cfset iMax = CreateObject("java","java.lang.Integer").MAX_VALUE />
<cfoutput>
#randrange(1, iMax)#   <!--- works fine --->
<br>
#randrange(0, iMax-1)#   <!--- works fine --->
<br>
#randrange(0, iMax)#   <!--- throws an error --->
</cfoutput>

What is the expected output? What do you see instead?

expected output would be an integer in the range 0 - iMax

If you got an error message, what is that error message?

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.expression.compile.CFFunctionExpression.Eval(Unknown
Source)

	at com.naryx.tagfusion.expression.compile.runTime.run(Unknown Source)
	at com.naryx.tagfusion.expression.compile.runTime.runExpression(Unknown
Source)
	at com.naryx.tagfusion.expression.compile.runTime.runExpression(Unknown
Source)

	at com.naryx.tagfusion.cfm.tag.cfTag.renderExpression(Unknown Source)
	at com.naryx.tagfusion.cfm.tag.cfTag.coreRender(Unknown Source)
	at com.naryx.tagfusion.cfm.tag.cfTag.render(Unknown Source)
	at com.naryx.tagfusion.cfm.tag.cfOUTPUT.render(Unknown Source)

	at com.naryx.tagfusion.cfm.tag.cfTag.coreRender(Unknown Source)
	at com.naryx.tagfusion.cfm.tag.cfTag.render(Unknown Source)
	at com.naryx.tagfusion.cfm.file.cfFile.render(Unknown Source)

What J2EE server are you running on and what Operating System?

OpenBD-jetty-6.1.9 on XP

If appropriate, include any information printed out in the bluedragon.log.



 
Sign in to add a comment

Hosted by Google Code