function [ x ] = randomwalk( init, bias, steps ) %RANDOMWALK Summary of this function goes here % Detailed explanation goes here x = zeros(1,steps + 1); x(1) = init; for j = 2:steps + 1 if rand <= bias x(j) = x(j-1) + 1; else x(j) = x(j-1) - 1; end end end