First, generate a series of random points as simple (x, y) coordinates. These points must fall within the Cartesian coordinates that bound the square. Of the total number of random points that are generated, some will occur within the circle.
Next, estimate by performing the following calculation: π = 4 × (number of points in circle) / (total number of points)
Write a C program that creates several threads, each of which generates random points and determines if the points fall within the circle. Each thread will have to update the global count of all points that fall within the circle. Protect against race conditions on updates to the shared global variable by using mutex locks.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here