Approximates pi using the Monte Carlo method.