# Random walk on lattice

I have a $9 \times 9$ square lattice. In each site of the lattice, there are $N$ molecules, where $N$ is a large random number and it is different for different sites. N equal to 100000000+-100 in beginning and changes by passing time. I want each molecule to do a random walk in each time step. $N$ is very large and it is not possible to apply random walk for each molecule in each site. Could anyone help? It is a part of other code, actually molecules f cites are consumed by other particles and they diffuse in time, but the part I have problem in is diffusion of molcules. I don't have enough score to answer the comments, so I answer here. Yes lattice is 2d. Yes, Exactly! I want number of particles in each site.But I don't underestand what do you mean. Could you provide an answer?

• I assumed that your lattice is 9x9x9, since it's cubic, and changed the question accordingly. Right now, you are not providing enough information. How big is N? What is the distribution of N? What is the purpose of your model? Mar 29 '17 at 18:45
• This sounds like you don't want to track each individual particles, but you want to track for each site the number of particles you have there. Based on how exactly you define your random walk, you need to define a time step model that relates the number of molecules at each site to the numbers at neighboring sites. Mar 29 '17 at 19:26

In the comments, @WolfgangBangert mentions the first part, the representation: instead of storing for $10^8$ particles a lattice location -- a two dimensional vector $(x,y)$ with 9 entries in each dimension -- you choose the dual representation by storing for each site $(x,y)$ the number of particles which occupy the site.
The second component is the transition. Straightforwardly, you would have to draw two times $10^8$ random numbers in order to check whether each one of the particles undergoes a transition. By this, however, you would have won nothing (regardless of the reduced representation of the system state in step one).
Therefore you approximate the distribution of the particles which undergo a transition by a normal distribution, which should be a very good approximation as your $N$ is quite large. The theoretical basis for this is the central limit theorem, and the parameters of the normal distribution depend on your microscopic transition law. You then draw a few random numbers from the normal -- which might even not be necessary as the normal should be really sharp, so it's possible you can just pick the mean.