added random walk algorithm