ENME 808S Homework - Compute Pi Using Monte Carlo Analysis
The following applet computes pi using a Monte Carlo approach. You must specify the number of samples used in the computation. The larger the sample size, the more accurate the result.
The source code for this applet can be viewed by pressing
here.
A sample result obtained using the applet above is provided below. With a sample size of 100,000,000 samples, a value for pi of 3.14158248 was obtained. The execution time on a 233 MHz machine for this sample size is slightly more than 4 minutes.