Consider a circle inscribed in a unit square. Given that the circle and the square have a ratio of areas that is π/4, the value of π can be approximated using a Monte Carlo method:

• Draw a square on the ground, then inscribe a circle within it.

•Uniformly scatter some objects of uniform size (grains of rice or sand) over the square.

•Count the number of objects inside the circle and the total number of objects.

The ratio of the two counts is an estimate of the ratio of the two areas, which is π/4. Multiply the result by 4 to estimate π.

(from Wikipedia)