This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libstdc++: add uniform on sphere distribution

On Sun, Jul 13, 2014 at 12:25 PM, Paolo Carlini
<> wrote:
> I don't think so. It depends on the past of the two different
> uniform_on_sphere: each time each uniform_on_sphere calls _M_n(__urng) the
> state of *its own* _M_n changes, evolves from the initial state.

I indeed should use the normal_distribution operator<< and operator>>
but I think for a different reason than you think.  The way the
normal_distribution is implemented produces two values at a time and
saves the second for a latter call.  So, yes, that implicit state has
to be preserved and I should have followed what Ed said.

But your 4th and 7th call example by itself is not a reason.  Again,
the input exclusively determined by the random numbers.  Here, of
course, the 4th and 7th use will produce different results.  But this
is not what the state of the distribution is supposed to capture.  For
that you'll have to save the state of the RNG as well.

I've checked in a patch to save the _M_n state.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]