Random Vector on a Sphere
Acceptance-rejection method of von Neumann
Iterate
(a) Generate 3 uniform random variates, r1, r2, r3 on (0,1)
(b) Calculate zi = 1-2ri, i=1,3, so that the vector z is distributed uniformly in a cube of side 2, centered on the origin
(c) Form the sum z2 = z12 + z22 + z32
(d) If z2 < 1, take the random vector as (z1/z, z2/z, z3/z) and quit
(e) Otherwise, reject the vector and return to (a)
Alternative algorithms are possible