You can simplify this quite a bit if you use a radius of 1, rather than a diameter of 1000. When R = 1, the test becomes $x * $x + $y * $y <= 1.
(Very) Old Habits Die Hard. Hence my use of $x*$x rather than $x**2. I doubt there's much difference on modern processors.
Update: s/\^/**/. Thanks to kyle for pointing it out
In reply to Re: probabilistic pi algorithm
by FunkyMonk
in thread probabilistic pi algorithm
by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |