Adjusted random walk generation algorithm.