I know there are several ways to generate uniformly distributed random points on the 2-sphere $S^2$. But I would like to know if my method does the same job, although it is very inefficient.

Say, I want to get random points on the surface of the sphere centered at the origin with radius $3$. My proposed algorithm is:

  • Take a random point $(x,y,z) \in [-3,3] \times [-3,3] \times [-3,3]$.
  • If $(2.999)^2 < x^2+y^2+z^2<3^2$, then $(x,y,z) \in $ SetOfRandomPoints
  • Proceed until the set has enough number of elements

Would this algorithm approximately generate a uniform distribution on the sphere, or would the points be clustered around, say, the equator?


Your method will work (although presumably you mean intervals of $[-3,3]$, not $[0,3]$).

You can get a uniform distribution of points within the sphere using rejection sampling (i.e., rejecting everything with a distance greater than $r$). What you're doing is effectively a double rejection, removing a sphere of radius $2.999$ from a sphere of radius $3$.


Your Answer

