This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] libstdc++: add uniform on sphere distribution
- From: Ulrich Drepper <drepper at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: Ed Smith-Rowland <3dw4rd at verizon dot net>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 13 Jul 2014 12:18:00 -0400
- Subject: Re: [PATCH] libstdc++: add uniform on sphere distribution
- Authentication-results: sourceware.org; auth=none
- References: <53C28FBB dot 9080708 at verizon dot net> <CAOPLpQcDX_mAdAxy2ZaqRE_UzYBOgQwcGkz66-RtfsEOhzkYmg at mail dot gmail dot com> <53C2A91D dot 1070808 at oracle dot com> <CAOPLpQc6OmUh=xStvxnUpEHdiP7vWf2-G31f4uCsJSp6iD75HQ at mail dot gmail dot com> <53C2AED6 dot 4040402 at oracle dot com>
On Sun, Jul 13, 2014 at 12:07 PM, Paolo Carlini
> Sorry, I still don't get it. When operator() of x and y, two
> uniform_on_sphere_distribution, call _M_n(__urng) and those _M_n have a
> different state, the numbers produced are in general different.
Correct. But in the case of this distribution once you have the
random numbers the remainder of the work is done by a fixed formula:
v = (N(0,1), ..., N(0,1))
result = v / ||v||_2
That's it, nothing else to be done.
If you have two calls of operator() of two different uniform_on_sphere
objects and you pass to each an RNG object in exactly the same state
you will get the same result.