Brownian Motion
Write a program to simulate Brownian motion of a small particle in a gas. When the button is clicked, the program draws a square of size 200 x 200 pixels on the form representing a container. It places a particle in the centre of the container and randomly moves it around to simulate Brownian motion. An ellipse represents the particle. It must be quite small, about 5 pixels in diameter. The particle must move 3000 steps in this simulation.
Use the random number generator to move the particle in small steps in random directions. There are 8 directions the particle could move in: up, down, left and right, and the diagonal directions. The particle must move no more than it’s diameter on any move. The timing of the moves must also be random, ranging between 20 and 50 ms.
You must also ensure that the particle cannot leave the container. If the particle reaches the container’s side, reverse its direction.
Credit Blundell@MonktonCoombe
IMAGE CREDIT: https://commons.wikimedia.org/wiki/File:Brownian_motion_gamboge.jpg