On Sat, 9 Aug 2014, Ulrich Drepper wrote:
If you are going to specialize for dim 2, I imagine you won't be
computing
normal distributions, you will only generate a point uniformy in a
square
and reject it if it is not in the ball? (interestingly enough this
is used
as a subroutine by the implementation of normal_distribution)
We need to be *on* the circle, not inside.
Yes, you still need the normalization step (divide by the norm). It
works whether you start from a uniform distribution in the disk or
from a Gaussian in the plane, but the first one is easier to generate
(generate points in a square until you get one in the disk). When the
dimension becomes higher, the probability that a point in the cube
actually belongs to the ball decreases, and it becomes cheaper to use
a Gaussian.