How to generate random points on a sphere
rojtberg.net
How to generate random points on a sphere
1–5 of 5 posts
Re: How to generate random points on a sphere
#2Alternatively you can generate random x, y, and z coordinates between -1 and 1 and toss it if it falls outside of the sphere (i.e. if x^2+y^2+z^2 > 1). Then just renormalized the coordinates so that they fall on the sphere.
The benefit of this is that the method easily generalizes to arbitrary dimension.
Re: How to generate random points on a sphere
#3http://extremelearning.com.au/how-to-generate-uniformly-rand...
Re: How to generate random points on a sphere
#4The method described in the article does not produce a spherically symmetric distribution since each value of z is equally likely. This means that a small circle near the north pole will contain as many points as the equator. Instead the different values for z should be selected with a probability that scales like 1/r where r is the radius of that circle (i.e. r = sin(theta)). Alternatively you can generate random x,…
Re: How to generate random points on a sphere
#5The method described in the article does not produce a spherically symmetric distribution since each value of z is equally likely. This means that a small circle near the north pole will contain as many points as the equator. Instead the different values for z should be selected with a probability that scales like 1/r where r is the radius of that circle (i.e. r = sin(theta)). Alternatively you can generate random x,…
Although the rejection method easily generalises, for higher dimensions say d>8, it becomes extremely inefficient and so may become unduly slow.
I haven't verified it but suspect that you might be able to improve on this by generating the coordinates in order, constantly decreasing the range to ensure that the point falls within the sphere. Then, to ensure spherical symmetry, you randomly shuffle the points at the end.