The Monte Carlo method uses random sampling in order to approximate calculations by performing random experiments on a computer. Can Silk Performer solve Pi using the Monte Carlo method? You can bet your bottom dollar it can – here’s how:

The Monte Carlo method uses random sampling in order to approximate calculations by performing random experiments on a computer.

A simple example of this is calculating an estimate for Pi and we can use Silk Performer to do this.

**Here is the logic and process that we can use:**

- The square below is 2×2 and the circle inside the square has a radius of 1.
- The area of a circle is πr2 therefore the area of the circle below is π*12 = π.
- The area of the square is 2*2 = 4.
- If we perform some clicks inside the square using completely random X and Y coordinates then the probability of the random click falling inside the circle is equal to the area of the circle divided by the area of the square. This is equal to π divided by 4 (π/4).
- Using this logic and a lot of random clicks we can then provide an estimate for the value of π by counting the number of clicks that fall within the circle and the total number of clicks performed.
- Some simple mathematics leads to the estimate for π being equal to the number of clicks inside the circle multiplied by 4 and divided by the total number of clicks.

So how can we use Silk Performer to calculate an estimate for π using the logic above?

Using Silk Performer’s powerful Browser Driven Load Testing (BDLT) technology we can perform actual random browser clicks on the hosted image above and keep a running total of where the clicks take place (inside or outside the circle).

Check out the video to see how this can be done using Silk Performer’s simple to use BDL scripting language.