The most beautiful experience we can have is the mysterious.

Estimate Pi

Monte Carlo Method

Area of square: $$S_s = L*L$$ Area of circle: $$S_c = Pi*(L/2)2$$ Draw random dots, with sufficient dots, the probability of dots appearing in the circle approaximately equals the area of the circle within the area of the square: $$N_c ⁄ N_c ≈ S_c ⁄ S_s = (Pi*(L/2)2) ⁄ (L*L)$$ $$=> Pi = N_c ⁄ N_s *4 $$ Play the demo here Code in Github