# Sampling a uniformly distributed point INSIDE a hypersphere?

Is there one to sample a point from inside it? (Sampling points from a hypercube and rejecting them if they are not inside the hypersphere would scale extremely poorly with $n$, as the vast majority of points would be rejected)

• Mark Meckes's accepted answer to that question answers this one too: take a random point on the $n+1$-dimensional hypersphere and drop two coordinates. – Nate Eldredge Aug 31 '18 at 22:23
• @NateEldredge $n+2$ perhaps, since we want to keep $n$ numbers? It's not super-obvious that this will be uniformly distributed though. – bobcat Aug 31 '18 at 23:25
• I think $n+1$ is correct; remember that the $n+1$-hypersphere is the unit sphere of $\mathbb{R}^{n+2}$. It may not be super-obvious but I think it's a fairly straightforward calculus exercise. – Nate Eldredge Sep 1 '18 at 1:58

Choose a uniform point $X$ on the unit hypersphere, then multiply it by $U^{1/n}$ where $U \sim U(0,1)$ is independent of $X$.