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


Isn't boost::mt19937 somewhat overkill for the simple RAND() functions?

3) It so happens that the algorithm used in boost is slightly faster
than glibc's, which is an added bonus.

If that's the case then my objection is moot :-)

The only problem with boost is the thousand or so header files it
includes and so slows down compilation but yes as the algorithm goes,
it's fast and has good statistical properties. It seems it also made
its way into the std library:

 http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine


As for RANDNORMAL() I'm very keen for this to happen because as far as
statistics is concerned it'll be used more than RAND(). I clearly
don't know about ODFF and which functions it includes but if it
includes density functions of statistical distributions then it should
in my opinion also contain their random generators. 

Independently of whether you decide to allow the use of boost, at
least the normal distribution generator can be easily implemented as:

 RANDNORMAL() = sqrt(-2.0*log(RAND())) * cos(2.0*M_PI*RAND())

 RANDNORMAL(mu, sigma) = mu + sigma *
                         sqrt(-2.0*log(RAND())) * cos(2.0*M_PI*RAND())

Other distributions can be more complicated ...

Tino


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.