Subject 6.08: How do I generate random points on the surface of a sphere?
There are several methods. Perhaps the easiest to understand is the “rejection method”: generate random points in an origin- centered cube with opposite corners (r,r,r) and (-r,-r,-r). Reject any point p that falls outside of the sphere of radius r. Scale the vector to lie on the surface. Because the cube to sphere volume ratio is pi/6, the average number of iterations before an acceptable vector is found is 6/pi = 1.90986. This essentially doubles the effort, and makes this method slower than the “trig method.” A timing comparison conducted by Ken Sloan showed that the trig method runs in about 2/3’s the time of the rejection method. He found that methods based on the use of normal distributions are twice as slow as the rejection method. The trig method. This method works only in 3-space, but it is very fast. It depends on the slightly counterintuitive fact (see proof below) that each of the three coordinates is uniformly distributed on [-1,1] (but the three are not independent, obvio