Estimating the value of pi through randomness.
This project demonstrates a simple Monte Carlo method for estimating the value of pi. The Monte Carlo method is a statistical technique that uses random sampling to obtain numerical results. In this case, we utilize the randomness to estimate the value of pi.
- Generate Random Points: Random points are generated within a square area.
- Check if Inside the Circle: For each point, we check if it falls inside the inscribed circle within the square.
- Calculate Pi Approximation: By comparing the number of points inside the circle to the total number of points generated, we approximate the value of pi.
To run the estimation:
g++ get_pi.cpp
./a.out