

clear time;
clear prob;
trials=1000000;
for n=1:trials
    x=1;
    step=0;
    while x>0 & step <1000
        step=step+1;
        x=x+2*round(rand)-1;
    end
    time(n)=step;
end % for n
for k=1:51
    prob(k)=sum(time==k)/trials;
end
figure; hold on; grid on;
title('log probability');
times=[21:2:41]
plot(log(times),log(prob(times)))
return



