The probability for a move to the right during a time step \( \Delta t \)
is \( n_l/N \). The algorithm for simulating this problem may then look
like this
- Choose the number of particles \( N \).
b* Make a loop over time, where the maximum time (or maximum number of steps) should be larger than the number of particles \( N \).
- For every time step \( \Delta t \) there is a probability \( n_l/N \) for a move to the right. Compare this probability with a random number \( x \).
- If $ x \le n_l/N$, decrease the number of particles in the left half by one, i.e., \( n_l=n_l-1 \). Else, move a particle from the right half to the left, i.e., \( n_l=n_l+1 \).
- Increase the time by one unit (the external loop).