The following simple Python code implements the above algorithm for particles in a box and plots the final number of particles in each part of the box.
The produced figure shows the development of this system as function of time steps. We note that for \( N=1000 \) after roughly \( 2000 \) time steps, the system has reached the equilibrium state. There are however noteworthy fluctuations around equilibrium.