There are some good questions and answers about picking random multivariate points over the surface of the hypersphere and the volume of the hyperball, just like this and this.
However none of the answers provide probability density function (PDF) for these distributions.
The related Wolfram Mathworld articles (this and this) also lack the PDFs.
The missing PDFs should be in the form $P(x; x_0, r)$.
where the parameters are
- $x_0$ is the location (center) of the hypersphere/hyperball
- $r$ is the radius of the hypersphere/hyperball
More specifically, the methods in question are the following:
Picking a random multivariate over the hypersphere:
If $X = (X_1, \ldots, X_n)$ are independent (iid) standard normal variates, then $x_0 + r \frac{X}{||X||_2}$ is uniformly distributed over the surface of the n-sphere (in the geometer's sense) with location $x_0$ and radius $r$.
Picking a random multivariate over the hyperball:
If $X = (X_1, \ldots, X_n)$ are independent (iid) standard normal variates, and $Y$ is a standard exponential ($\lambda = 1$) variate, then $x_0 + r \frac{X}{\sqrt{Y + ||X||_2^2}}$ is uniformly distributed over the volume of the n-ball with location $x_0$ and radius $r$.
Alternatively, using a variate $U$ uniformly distributed over $[0,1]$, the expression $x_0 + r U^{1/n} \frac{X}{||X||_2}$ is also uniformly distributed over the hyperball.