Random vectors on a sphere

Dear Rooters,
I’m pretty new with root, so be patient! I’m looking for a way to generate random vectors uniformly distributed on a sphere exactly like the fortran subroutine RN3DIM, contained in the mathlib, did.
Can you help me?

thanks in advance…


see a function and a small test program in the attachement

Sphere.C (1.32 KB)

Perfect!!! thank you very much!


In the development version, I have added
TRandom::Sphere and a new tutorial spheres.C