Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hey Tino,

2012/12/6 tino <ttk448@gmail.com>:
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
sc::rng::uniform_int(a,b).

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

Small problems:
 - compiler warnings from within boost

We need to patch them out otherwise the Werror build will fail. It
seems that these warnings are also fixed upstream.

 - few asserts might need to be replaced


asserts are fine in the code. They are only used in debug and dbgutil
builds, so will normally not show up in releases but helpt to find
bugs earlier.

Just a few more comments about the patch. We need to ifdef all unused
methods in random.[ch]xx otherwise they will be removed in nearly no
time. We are removing unused functions to clean the codebase. Please
also don't leave old code commented, we have git for code history so
we don't need to keep all code as comments. Before I'll push the
change with these modifications I'll check with a big file containing
a lot of RANDOM functions to check that we are not introducing a
performance regression.

Regards,
Markus

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.