This program is an implementation of a 2d uniform random walk using the linear congruent pseudo RNG. It is part of exercise 5.4 of the compuational physics textbook by Landau (2015)1 that aims to introduce Monte Carlo methods.
The program uses the linear congruent method to generate random numbers. The algorithm to get the random number is:
and
The random walk takes 2 random numbers initialized with different seeds for its X axis and Y axis. The random numbers are then normalized by its length so that the resulting vector has a length of 1.
Footnotes
-
Landau, R. H. (2015). Computational physics problem solving with python. John Wiley & Sons, Incorporated. ↩