- How do I generate $1000$ points $\left(x, y, z\right)$ and make sure they land on a sphere whose center is

$\left(0, 0, 0\right)$ and its diameter is $20$ ?.- Simply, how do I manipulate a point’s coordinates so that the point lies on the sphere’s “surface” ?.

**Answer**

Use the fact that if you cut a sphere of a given radius with two parallel planes, the area of the strip of spherical surface between the planes depends only on the distance between the planes, not on where they cut the sphere. Thus, you can get a uniform distribution on the surface using two uniformly distributed random variables:

- a $z$-coordinate, which in your case should be chosen between $-10$ and $10$; and
- an angle in $[0,2\pi)$ corresponding to a longitude.

From those it’s straightforward to generate the $x$- and $y$-coordinates.

**Attribution***Source : Link , Question Author : Filip , Answer Author : Brian M. Scott*