A simulation that draws two spherical angles uniformly can produce unit-length directions and balanced positive and negative coordinates while still favoring the poles. The missing ingredient is surface area. An isotropic direction distribution assigns equal probability to equal solid angles, and equal polar-angle intervals do not generally have equal solid angle.
Define exactly what is being sampled
Consider invented direction vectors used as mathematical inputs to a robot perception or motion simulation. Each vector starts at the origin and ends on the unit sphere. There is no claimed sensor field of view, collision experiment, or measured deployment in this example.
Define theta as the polar angle measured down from the positive z axis, ranging from zero to pi. Define phi as the azimuth around z, ranging from zero to two pi. Then x = sin(theta)cos(phi), y = sin(theta)sin(phi), and z = cos(theta).
These definitions matter because references use different angle names. The MathWorld sphere-picking page uses the opposite assignment of theta and phi. PBRT's sampling appendix makes the probability measure explicit. Here, uniform means constant density 1/(4 pi) with respect to solid angle over the full sphere.
Why uniform theta overweights small caps
On the unit sphere, the area element is sin(theta) dtheta dphi. A narrow band at the equator has more area than a band with the same theta width near a pole. Giving both bands the same probability puts more samples per unit area near the pole.
Integrating over azimuth gives the correct polar density f(theta) = sin(theta)/2. Its cumulative probability from the north pole down to angle alpha is [1 - cos(alpha)]/2. This result counts area rather than merely counting angle width.
Take a north polar cap with alpha = 30 degrees. Its correct probability is [1 - sqrt(3)/2]/2, approximately 0.0669873. Drawing theta uniformly over 180 degrees instead gives 30/180 = 1/6, approximately 0.166667. The incorrect construction allocates about 2.488 times as much probability to that cap.
For 12,000 independent samples, the expected cap counts would be about 803.85 under isotropic sampling and 2,000 under uniform theta. These are expectations, not promises of exact counts in one random run. No pseudorandom generator has been run to produce a sample cloud for this article.
Use height to make equal-area bands
Let z = cos(theta). Since dz = -sin(theta)dtheta, the area between two heights z1 and z2 is 2 pi times their height difference. Dividing by the whole area 4 pi gives probability (z2 - z1)/2, for -1 ≤ z1 ≤ z2 ≤ 1.
The band from z = 0.5 to z = 1 has probability 0.25. The band from z = -0.25 to z = 0.25 also has probability 0.25. One is a polar cap and the other crosses the equator, but both have height width 0.5. Their different shapes do not change their equal areas.
Therefore choose z uniformly on [-1,1] and phi uniformly on [0,2 pi), independently. The remaining radius in the xy plane is rho = sqrt(1 - z²). Set x = rho cos(phi) and y = rho sin(phi). This constructs a direction without needing to compute an inverse cosine.
An original two-number calculation
Let independent uniform inputs U and V each range over [0,1]. Choose z = 1 - 2U and phi = 2 pi V. For the selected values U = 1/4 and V = 1/6, z is 1/2 and phi is pi/3. The planar radius is sqrt(3)/2.
The resulting vector is (sqrt(3)/4, 3/4, 1/2), approximately (0.4330127, 0.75, 0.5). Its squared length is 3/16 + 9/16 + 1/4 = 1. The construction is geometrically valid, and the distribution argument above establishes why many such inputs have the desired area measure.
Choosing 2U - 1 instead for z also gives a uniform height distribution. It reflects which input values map toward which pole, not the resulting probability law. A single selected vector will change, so preserve the mapping when comparing reproducible input lists.
Zero means can conceal directional bias
Both the correct construction and uniform theta with uniform azimuth have zero expected x, y, and z. Their symmetry makes coordinate means a weak diagnostic. A sample can be centered without being isotropic.
For correct uniform height, E[z²] is the integral of z²/2 from -1 to 1, giving 1/3. Rotational symmetry gives E[x²] = E[y²] = 1/3 as well. For uniform theta, E[cos²(theta)] is 1/2, so the z second moment becomes 1/2 instead.
The incorrect construction leaves E[sin²(theta)] = 1/2. Uniform azimuth splits that equally between x and y, giving 1/4 for each. The three second moments still sum to one because every vector has unit length, yet they reveal a preferred z direction. Unit normalization alone cannot fix the area weighting.
Match diagnostics to the intended domain
Equal-width z-band counts and spherical-cap counts test different visible consequences of the same area law. Finite random samples fluctuate, so exact equal counts are not required. A useful comparison retains the expected probabilities and the actual sample count.
Uniform directions on a sphere are not uniform points inside a solid ball, and a direction does not specify a full three-dimensional orientation with roll. A hemisphere restriction also changes normalization. State the domain and measure before adapting the construction to a robot simulation; otherwise a mathematically valid unit vector can answer the wrong sampling question.
Sources checked October 24, 2026:
https://pbr-book.org/4ed/Sampling_Algorithms/Sampling_Multidimensional_Functions — Appendix A.5.2 sphere sampling and solid-angle density.
https://mathworld.wolfram.com/SpherePointPicking.html — Spherical area element and polar-angle distribution.
Illustration note: The robot beside a laptop is a concept illustration for simulation preparation. Its screen does not show these direction samples, an executed algorithm, or experimental results.