I am searching two simple/efficient/generic algorithms to generate a uniform distribution of random points:
- in the volume of a n-dimensional hypersphere
- on the surface of a n-dimensional hypersphere
knowing the dimension $n$, the center of the hypersphere $\vec{x}$ and its radius $r$.
How to do that ?
Aperantly, for picking points on the surface of a hypersphere is to generate $n$ Gaussian random variables $x_1, x_2, ...x_n$, and then use the vectors:
$$\frac{1}{\sqrt{x_1^2+x_2^2+...+x_n^2}} \left( \begin{array}{c} x_1\\ x_2\\ ..\\ x_n\\ \end{array} \right)$$ Which will be uniformly distributed on the the surface of the hypersphere.