random number generators for calc

tino ttk448 at gmail.com
Wed Nov 28 11:41:39 PST 2012


> 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.

If there are no issues with using boost then I'd suggest 2) and use
boost's implementation of Mersenne Twister (boost::mt19937) as default
for all.

 http://en.wikipedia.org/wiki/Mersenne_twister

I've attached a simple example on how the boost generator works. It
also turns out to be slightly faster than rand().

What is your opinion on implementing generators for other
distributions like normal and all the ones listed under statistics
(which calculate densities but don't generate)? With boost this is
simple so just a matter of extending the UNO interface.

Cheers, Tino
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boost_rand.cpp
Type: text/x-c++src
Size: 1803 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20121128/1762b2b3/attachment-0001.cpp>


More information about the LibreOffice mailing list