You have an answer for the surface of the sphere, so I'll just address the question about the interior of the $n$-ball.
For sufficiently small $n,$
the rejection method is a reasonably efficient way to get a
uniformly distributed random point in the unit ball of $n$ dimensions.
For larger $n,$ a more efficient way to get a uniform distribution within an $n$-dimensional ball is to first find a point uniformly distributed on the surface of an $n$-dimensional sphere,
and then take a point in the same direction from the origin but at a random distance.
Given that the ball has unit radius, a concentric smaller ball of radius $x$ has volume $x^n$ times the volume of the unit ball, so if $X$ is the distance from the center to a randomly chosen point inside the unit ball, the probability distribution function of $X$ should be
$$ F_X(x) = \mathbb P(X \leq x) = \begin{cases}
0 & x < 0, \\
x^n & 0 \leq x \leq 1, \\
1 & x > 1.
\end{cases} $$
The probability density function of $X$ then is the derivative of the distribution (almost everywhere),
$$
f_X(x) = \begin{cases}
n x^{n - 1} & 0 \leq x \leq 1, \\
0 & \text{otherwise}.
\end{cases}
$$
In order to produce a variable $X$ with such a distribution, given a variable $U$ that is uniformly distributed on $[0,1],$
note that for $0 \leq x \leq 1,$
$$
\mathbb P(X \leq x) = x^n = \mathbb P(U \leq x^n)
= \mathbb P(U^{1/n} \leq x),
$$
so you can set $X = U^{1/n}.$
For a ball of radius $r$ around an arbitrary center, just take the unit ball, scale it to radius $r$ and translate it so its center is at the desired location.