https://bz.apache.org/bugzilla/show_bug.cgi?id=62738
Bug ID: 62738
Summary: RANDBETWEEN function rounds the value down to int
Product: POI
Version: 4.0.0-FINAL
Hardware: PC
Status: NEW
Severity: major
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
I have a cell in Excel file with the following formula:
=RANDBETWEEN(0, 9999999999)
When I call FormulaEvaluator::evaluateAll() the cell mostly gets the value
2147483647 (signed int32 max), which is not very random. The formula works fine
in Excel.
I briefly looked at the code of org.apache.poi.ss.formula.atp.RandBetween
class, and the int cast in the line
return new NumberEval((bottom + (int)(Math.random() * ((top - bottom) + 1))));
seems to be the problem.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]