Points are generated randomly and follow a uniform distribution in the square.
Hence, the probability that a point is generated in the circle is
If we call the proportion of points inside the circle when we have generated points, according to the law of large numbers the limit of is
So we use as an estimation of , and it becomes a good estimation when there are enough points.