In this problem we aim to approximate π using the Monte Carlo method.

Modify the code to run the calculation in parallel.

An interesting issue arises when we try to have reproducible computation. Simply using a seeded pseudo random generator, while accessing it from multiple threads (in a different order each time) defeats the purpose as our computations are still non-deterministic. Instead we use a different generator state in each thread We use the erand48 function to explicitly pass the generators state in each call. To ensure different random values for each thread they also need to be seeded with the thread number.