Demosthenes Patramanis

PHILOSOPHY | MATHEMATICS

DPhil (Oxon), MA, MSc, Bsc

Random Walk

This will illustrate a random walk using Matplotlib with the following attributes:

  • Movement takes place in two dimensions (x-axis and y-axis).
  • The starting point is (0, 0).
  • The number of steps is 5000.
  • The length of each step is between 0 and 5 (included, and only integers), and steps with no movement in both directions are disregarded.
  • Each point in the scatter plot takes a darker shade of blue with each step.
  • The start point (0, 0) is colored green and the end point is red.

Try running the program several times to see different walks.

Click here to open Random Walk in a new page.