recent coverity and rand
nthiebaud at gmail.com
Sat Oct 4 15:27:20 PDT 2014
On Sat, Oct 4, 2014 at 3:23 PM, Caolán McNamara <caolanm at 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,
>> * 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)) ?
More information about the LibreOffice