tracker issue : CF-4132630

select a category, or use search below
(searches all categories and all time range)
Title:

RandRange() does not work on as documented

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 03/28/2016

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win All

Vote Count: 1

Listed in the version 2016.0.02.299200 Issues Fixed doc
Problem Description:

Doc of RandRange says "If the numbers are not in the range -2,147,483,648 - 2,147,483,647, ColdFusion generates an error." but testing such edge case returns unexpected result.


Steps to Reproduce:

A:  #randrange(-2147483648, 2147483647) #
B:  #randrange(0, 2147483647)#

Actual Result:

A:  -2147483648
B:  (some random negative number)


Expected Result:

A:  some random number in between MIN_INT and MAX_INT
B:  some random number between 0 and MAX_INT


Any Workarounds:

Ridiculously convert UUID from createUUID() into binary and then into a number?

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4132630

External Customer Info:
External Company:  
External Customer Name: Henry Ho
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

http://ryanguill.com/cfml/math/2016/02/21/a-better-randrange.html
Comment by External U.
3215 | March 28, 2016 04:30:24 PM GMT
FYI, this bug has been here since CF8 https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3041752
Comment by External U.
3216 | March 28, 2016 04:32:13 PM GMT
It has been 6 years, that should be enough time.
Vote by External U.
3219 | March 28, 2016 05:29:45 PM GMT
test note
Comment by CFwatson U.
3217 | June 07, 2016 04:17:52 AM GMT
The fix for this bug is available as part of the early-access build for ColdFusion 2016 Update 2.
Comment by CFwatson U.
3218 | June 07, 2016 04:24:33 AM GMT