random number generators for calc

tino ttk448 at gmail.com
Thu Dec 6 06:25:57 PST 2012

> > just happened to reimplement RAND() with a B.A Wichmann
> > and I.D Hill generator.. see
> 	As they are entitled to. No doubt we'll come up with a comprehensive,
> nicely architected and beautiful solution of our own :-)

Ok, I'll go ahead with a suggestion then. :)

Attached patch is just a simple wrapper around boost, to be used like

sc::rng::seed() to replace libc srand()
sc::rng::rand() to replace libc rand()

and a few more distributions.

I've also modified ScInterpreter::ScRandom()
to simply call sc::rng::uniform()
which should solve bug 33365.

I've not modified RANDBETWEEN(a,b) yet but this could simply call

Also, the rand in Basic could be changed in the future.

Small problems:
 - compiler warnings from within boost
 - few asserts might need to be replaced

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fdo-33365-added-wrapper-for-boost-random-use-that-in.patch
Type: text/x-patch
Size: 11901 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20121206/b6875983/attachment.bin>

More information about the LibreOffice mailing list