This program randomly places points inside the square above and counts how many points also happen to fall inside the quadrant of the circle with radius equals to the side length of the square (lets call this side length 'r').

Because the area of the square is r², and the area of the circle quadrant is πr²/4. We would expect the ratio of the numbers of points that land inside the circle quadrant to the number of points all up to be the same as the ratio πr²/4:r².
The r² term can then be cancelled out and we are left with an ratio that is ¼ of π.

The more points placed, the closer the ratio will be to its actual value and the better the approximation of π