random number generators for calc

tino ttk448 at gmail.com
Thu Nov 29 09:48:48 PST 2012

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


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


More information about the LibreOffice mailing list