M0UNTAIN 0F C0DE

π Day 2026 🥧

Monte Carlo maths simulation π

Happy Pi day 2026!

I wanted to write a little simulation which (badly) approximates Pi. It's called the Monte Carlo method and simply involves placing a circle inside a square and then randomly placing points anywhere inside the square.

The ratio of points outside the circle to inside is ¼π. This isn't an animation, it's a streamed image of the simulation, refresh to get a new run. I love how randomness can lead to Pi.