n=10000

x=NaN(1,n);
y=NaN(1,n);

for i=1:n
    hit=false;
    while not(hit)
        x0=2*rand-1;
        y0=2*rand-1;
        if x0^2+y0^2<1
            hit=true;
        end
    end
    x(i)=x0;
    y(i)=y0;
end

r=sqrt(x.^2+y.^2);

figure(1)
scatter(x,y)
figure(2)
plot(sort(r))
figure(3)
plot(sort(r.^2))