
function expected_time(trials)
tic
clear time;
clear prob;
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
expected_time_to_zero=sum(time)/trials
toc

