Trying to understand the random number generator "double RanPark::uniform()" in use

For example, look into “void CreateAtoms::add_random()”, it appears that a unique “seed” read from the input script is used in “RanPark *random = new RanPark(lmp,seed);”. But then I do not understand how “random->uniform()” can produce a different random number in a loop to create lots of random atoms, while I do not find that the “seed” is changed during the loop?

I must have missed the key part in understanding how it works. Thanks in advance for any comment on this.

Best regard,

Well, if you check the source of the Park-Miller random number generator (RanPark.cpp) you can see that the member function “double RanPark::uniform()” changes the value of the member variable “seed”. This member variable is set to the seed given in the LAMMPS input script once (during construction) but afterwards, each time the member function “uniform” is called, the value of the member variable seed changes.

Cool, thanks.