I have a function (copied from the MATLAB documentation) which generates random points inside a sphere. However, some points inside the sphere are not permissible. How can I generate random points inside a hollow sphere with permissible radius 1<r<2. In other words, the points should lay on a radius of 1 to 2 so no points are allowed between r = [0 1].
EDIT: Completely forgot to include the function
function [x,y,z] = PointsInSphere(r,n)
rvals = 2*rand(n,1)-1;
elevation = asin(rvals);
azimuth = 2*pi*rand(n,1);
radii = r*(rand(n,1).^(1/r));
[x,y,z] = sph2cart(azimuth,elevation,radii);
end