random walk and clamping functions