random number generators for calc
Kohei Yoshida
kohei.yoshida at gmail.com
Wed Nov 28 10:36:07 PST 2012
On 11/28/2012 01:00 PM, tino wrote:
>> So, Michael Stahl commented in the bug that we do have our own
>> random number generator function. One way is to just replace the
>> direct call to rand() to this function instead. That should be very
>> easy to do and I have no objection against it.
>
> Just to be clear, I believe glibc's implementation of rand() is
> excellent and doesn't need replacement unless one needs particular
> statistical properties (the problem is only with windows rand()).
> Boost offers generators I believe similar to glibc's rand() as well as
> a few which have even better statistical properties but are slower.
(...)
> As for the bug report, if he's referring to
>
> ./core/sal/inc/rtl/random.h
>
> then I can't see any function we can easily use for our purposes.
Thanks for the additional insight. Well, I can see two possibilities:
1) Use boost's generator for Windows platform-only, while we keep the
glibc's version for Linux. I wonder what the situation is on Mac...
2) Use boost's generator for all platforms.
I don't see the need to replace it for Linux if it's not broken. OTOH,
making this platform-dependent may make the maintenance a bit more
difficult. Especially when the behavior of the random number generator
changes between platforms it may have an undesirable effect. Having
said that, since we are talking about random numbers, having slightly
different behaviors between platforms may not be such a big issue.
I don't really have any preferences for one over the other. But I do
like to see this problem solved especially on Windows.
Kohei
--
Kohei Yoshida, LibreOffice hacker, Calc
More information about the LibreOffice
mailing list