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

Marc Glisse marc.glisse@inria.fr
Sat Aug 9 07:15:00 GMT 2014

On Fri, 8 Aug 2014, Ulrich Drepper wrote:

> Now also for a fix of the sphere distribution. Unless someone objects 
> I'll check in the patch below.
> 2014-08-08  Ulrich Drepper  <drepper@gmail.com>
> 	* include/ext/random.tcc
> 	(uniform_on_sphere_distribution::__generate_impl): Reject
> 	vectors with norm zero.

While there, do we want to also reject infinite norms?
I would have done: while (__sum < small || __sum > large)
but testing exactly for 0 and infinity seems good enough.

Marc Glisse

More information about the Libstdc++ mailing list