Random Systems & Random Number Generators
Random Walker in one dimension

I wrote a program (including the random generator) that plots position as a function of time of a random walker in one dimension. For each step the walker can go forward or backward. The following plots represents 10 trajectories of 1000 steps. The mean of the 10 trajectories is plotted in white. The probability of moving forward or backward is equal. In yellow is the error bars of width 3*sigma(t) = +/- 1.5 sqrt(t).

In this example, I plotted 40 trajectories. Note how the mean stays closer to 0.

For the two last examples, I set the probability of going forward to 0.52 and then 0.6.

Here is the Matlab code :