https://bugs.freedesktop.org/show_bug.cgi?id=70474
Priority: medium
Bug ID: 70474
Assignee: [email protected]
Summary: Random number generation weak with Rnd in BASIC
Severity: normal
Classification: Unclassified
OS: Windows (All)
Reporter: [email protected]
Hardware: x86 (IA32)
Status: UNCONFIRMED
Version: 4.0.5.2 release
Component: BASIC
Product: LibreOffice
Created attachment 87644
--> https://bugs.freedesktop.org/attachment.cgi?id=87644&action=edit
Test file
The RAND() function of Calc was fixed on bug 33365. Yet the same bug is present
with the "Rnd" random number generation function of BASIC as well.
Even with as few records as 1000, the "random" numbers repeat themselves
several times. Test document (ODS) with test macro attached.
TEST PROCEDURE:
1. Open the attached document
2. Click the "Generate" button to (re-)generate 1000 numbers. Wait for
"Generation Status" to change from "Started..." to "Ready"
EXPECTED RESULTS:
2. Cell D1 shows 1.00000000 (i.e. no repetition of values in the B column)
ACTUAL RESULTS:
2. Value of D1 always bigger than 1.00000000 (between 1.02200000 and 1.04400000
on just a few tests), due to many repeated values in the B column. (Column C
shows how many times a number is repeated.)
WinXP Home 32 bit, LO 4.0.5.2 release
NOTES:
- The issue does not occur on with the test file attached to bug 33365, which
tests the RAND() function of Calc. To achieve comparable results, my attached
file is based on that file and uses the same evaluation methods.
- Usage of the "Randomize" generator initialization function before the first
"Rnd" usage does not work around the problem.
- Calc RAND() fix commit
http://cgit.freedesktop.org/libreoffice/core/commit/?id=8450a99c744e9005f19173e4df35d65640bcf5c4
says that seed() "initialises the state of the global random number generator"
and it "should only be called once at the start of the main programme". So,
maybe the latter information should be added to the description of the
"Randomize" function in LO help. Because, according to that information,
additional later seeding of the random number generator would make it loose the
entropy it has accumulated so far. (Assuming it does accumulate it continuously
since application start.)
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs