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


On Sat, Oct 4, 2014 at 3:23 PM, Caolán McNamara <caolanm@redhat.com> wrote:
On Thu, 2014-10-02 at 23:35 +0200, Michael Stahl wrote:
* direct usage of boost::random for fancy distributions in Calc,
  sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx

* include/comphelper/random.hxx:
  double uniform() function with [0,1) range
  implemented with boost::random / MersenneTwister for speed


... so i'd guess that the comphelper/random.hxx approach is most
promising for general-purpose random numbers (i.e. not crypto); it even
nicely encapsulates the boost template madness behind a small ABI.

oh, there is also a <random> header in C++11, likely inspired by
boost::random; i wonder if our new baseline toolchains have support for
this... actually GCC 4.5 release notes list it as a new feature, and
MSVC 2012 has it too:

Hmm, little trap here, uniform_int_distribution takes [a,b] range while
uniform_real_distribution takes [a,b).

so: (int)(floor(uniform_real_distributtion(a, b+1)) ?

Norbert

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.