Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
gussfish
Creator II
Creator II

rand() result > 1.0

Hi Folks,

I just ran a script in which rand() appears to have returned a value greater than 1 !  I actually wanted to test empirically if it'd return exactly 0 or 1 (the documentation on it not being crystal clear on this point), and was surprised to get this result.

Basically, I rand a script to call rand() a billion times and pick-out the min & max values, resulting in the following Script Execution Progress dialog box output:

 

    Rands << AUTOGENERATE(1000000000) 1 lines fetched
    vMIN=4.6566128774142e-010
    vMAX=1.0000000004657

This is in QV Developer 11.00.11414.0 SR2.  QVW is attached.

Does anyone else get this?

Angus.

Labels (3)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III

Hi Angus,

I got the same result on my third reload. I think this should be submitted as a bug.

QV Desktop v11.20.12018.0 SR3 x64.

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

9 Replies
rbecher
Partner - Master III
Partner - Master III

Hi Angus,

I got the same result on my third reload. I think this should be submitted as a bug.

QV Desktop v11.20.12018.0 SR3 x64.

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
gussfish
Creator II
Creator II
Author

This has now been reported to QlikTech, Bug ID #65575.

Angus.

gussfish
Creator II
Creator II
Author

QlikTech support has come back to be and reported that after an in-depth analysis, yes, rand() can return values >1.0 but is by design"!  

"Dear Angus, Regarding this issue, our R&D did an in-depth investigation and came out with a conclusion that this is actually by design. They also summarized the findings into an article, which is attached to this email. Should you need any further assistance please let me know. Or please confirm if we can close this support case."

(See attachment for their article).


I am shocked and absolutely appalled by this response, that they should dismiss this behaviour as being "as designed" when it clearly breaks its contract.  What do other people here think about this?

Angus.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would agree that it's an unsatisfactory answer. The doc, both pdf and help, only state:

"Returns a random number between 0 and 1."

If R&D is stating that it's ok to return something other than 1, then it's a documentation bug. I would ask to escalate the issue, and have it accepted as either a behavior bug or a doc bug. It seems it has to be one or the other.

-Rob

rbecher
Partner - Master III
Partner - Master III

Rounding is not a really good idea. A test showed it creates accumulations of values even on small amount (50k) of records/calls of rand()..

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
gussfish
Creator II
Creator II
Author

QlikTech have now accepted this as bug #65575, related to how the random seed is generated.  "The probability for the issue to occur is consider to be approx. 1 every 2 billion random values, with an

increased probability the closer to 2 billion generated you get."

gussfish
Creator II
Creator II
Author

QlikTech have notified me that this bug is now fixed in 11.2SR5(12235).   I'm not in a position to verify this for myself at the moment, though.

rbecher
Partner - Master III
Partner - Master III

Hi Angus,

I cannot reproduce the issue with your app in v11.2 SR5:

rand.png

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
gussfish
Creator II
Creator II
Author

Good one - thanks Ralf!