I had to make an efficiency comparison of ways to calculate Pi for a class (based on # of iterations). One is statistical and the other is algebraic. I figured I would post them here.
Monte Carlo Method of calculating Pi (statistical)
;Monte Carlo method to calculate Pi
$incircle = 0
$count = InputBox("Monte Carlo", "Please enter how many samples to calculate")
For $i = 0 To $count
$hypo = pythagoran(((Random(0, 1) * 2) - 1), ((Random(0, 1) * 2) - 1))
If $hypo <= 1 Then $incircle +=