num_runs = 10;
max_steps = 1000;

positions = zeros(max_steps, num_runs);

for run = 1:num_runs
    for step = 2:max_steps
        x = randn(1);
        if x < 0
            positions(step, run) = positions(step-1, run) + 1;
        elseif x > 0
            positions(step, run) = positions(step-1, run) - 1;
        end
    end
end

figure()
hold on
for run = 1:num_runs
    plot(1:max_steps, positions(:, run))
end
xlabel('Number of steps')
ylabel('Position')
box off


