### Random walk oscillator

*May 2017: This is from my other blog that's no longer online. The original comments are no longer available, but you are welcome to add more.*Here's an experiment. Suppose I want to make a random walk that I can control, that doesn't wander aimlessly all over, but rather is attracted to zero. The attraction back to zero wouldn't act like a force that causes steps away from zero to become smaller in size; rather, steps toward zero are simply more probable further away from zero, regardless of the step size. I'll invent a random walk that does this. We generate random walk steps in a generalized way via some inverse cumulative distribution function (cdf), which could represent a gaussian, a black swan, binary ±1 steps, whatever. This inverse cdf, in turn, takes as an input a random probability

*p*that's

*uniformly*-distributed between 0 and 1. (If you want uniformly-distributed steps, the step size simply equals the input

*p*, or a multiple of

*p*.)We need to skew this u…