4 ms·
I think he does mean sampling from a gaussian. You can tell because the example calls randn(). The gaussian distribution is invariant under rotations in 3d (a
by kkylin 8y ago
I think he does mean sampling from a gaussian. You can tell because the example calls randn().
The gaussian distribution is invariant under rotations in 3d (and more generally invariant under any orthogonal transformation in any dimension), so if one takes a random vector X whose components are independent N(0,1) random variables and compute X/|X| (where |X| is the usual euclidean norm of X) the result is guaranteed to be uniform on the unit sphere.
- kkaranth 8y agoIndeed, I've used randn() wherever a normally distributed random number is needed. This is computed using the Box-Muller method.