function [] = rand3d(p)
upper=power(2,p)-1;
x=rand(upper,1);
top = upper -1 % top is even
x1 = x(1:2:(top-1),1);
x2 = x(2:2:top,1);
top2 = top/2;
y = zeros(10,10);
for j = 1:top2
    s1 = min(10,1+floor(x1(j,1)*10));
    s2 = min(10,1+floor(x2(j,1)*10));
    y(s1,s2) = y(s1,s2)+1;
end
bar3(y);