|
Boost Users : |
Subject: Re: [Boost-users] [Random] normal distribution different behaviour 1.55 vs 1.57
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2014-12-18 15:18:30
Thomas M wrote:
> On 18/12/2014 18:51, John Maddock wrote:
>>>> Neither for 1.56.0 nor 1.57.0 does the change-log list an update to the
>>>> random numbers library, so first I am puzzled why the libraries behave
>>>> differently (though [Math] has undergone some changes -> propagation to
>>>> [Random]?). Second, it is not clear to me why for the first bunch of
>>>> uniformly distributed variates the results are identical, while for the
>>>> second, after normally distributed variates were generated, the are not.
>>>> It appears that the generation of normally distributed variates changes
>>>> the whole state of the random numbers engine in a different manner [e.g
>>>> multiple engine calls ??].
>>>> Any insight into what is going on here is much appreciated. And
>>>> foremost: Is any of 1.55 or 1.57 bugged, that is one should be clearly
>>>> preferred over the other?
>>>
>>> I've observed this, too! The change seems to have been introduced in
>>> Boost version 1.56.
>>
>> Looks like the normal distribution was completely rewritten between
>> those two releases:
>>
https://github.com/boostorg/random/commit/f0ec97ba36c05ef00f2d29dcf66094e3f4abdcde
>>
>>
>> Beyond that I know nothing, John.
>
> Ok it appears that the algorithm generating the variates was completely
> changed (from Box-Muller to Ziggurat sampling), where the latter makes a
> variable number of engine calls. Thus not only differ the genertaed
> normally distributed variates themselves, but also the state of the
> engine afterwards.
>
> A quick search yielded that the Ziggurat is faster, but can someone also
> comment specifically on the robustness of the provided implementation?
> What has been the prime motivation of the change?
>
> Is it intended that such changes which are transparent to end-users do
> not become reflected in the change-logs? In my case I have the troubles
> that now firstly all my existent test cases are invalidated (the lesser
> issue) and that in general reproducibility among runs is not provided
> any more if I upgrade to 1.57 (the greater issue).
>
> thanks, Thomas
I'd like to add my $0.02 here as well. This had happened to me some years ago,
I believe to make boost::random conform to std::random. The breaking of tests
is a bad thing. It should only be done after careful consideration. And then,
it should be advertised LOUDLY in the release notes. Otherwise, some poor
schmuck is going to waste a lot of time tracking down why his tests broke. And
the random number generator is the last place he'd suspect.
-- -- Those who don't understand recursion are doomed to repeat it
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net