function [w]=dicrete_random_walk()
p = 0.3;
N = 200;
w0 = 0;

w= ones(1,N);
w(1)=w0;

u = rand(N,1);
dec = p >=u;

figure(1);
subplot(2,1,1);
stem(1:N,dec);
xlabel('Discrete Time')
title('Bernoulli Sequence');

for i = 2:N
    if dec(i) == 1;
        w(i) = w(i-1) - 1;
    else
        w(i) = w(i-1) + 1;
    end
    subplot(2,1,2);
    stem(1:N,w);
    title('Discrete Random Walk')
    xlabel('discrete time')
    ylabel('level')
end