Think about Loose Coupling  
PerlMonks 
Accuracy of Random Piby gryng (Hermit) 
on Feb 16, 2001 at 06:16 UTC ( #58767=note: print w/replies, xml )  Need Help?? 
Running for 10,000,000 twice I got 3.1405 the first run, and 3.1424 the second. (for an average of 3.1415) It's quite likely your rand() isn't perfect. (neither is mine 10,000,000 runs should give me a digit or two more accuracy).
Anyway, here is my favorite approximation for pi, mainly because it only uses the number 2. Even though two is normally a computer friendly number, this algorithm isn't, because it also uses sqrt's. With my perl, 14 iterations is gives the maximum accuracy: 3.14159265480759
So, while not the best, but I have some strange affinity to it. :) Ciao,
p.s. Sorry for the cryptic code for a quick decrypt its: (2**n)*sqrt(2sqrt(2+sqrt(2+sqrt(2+sqrt(2))))) with the number of 2's inside the sqrt equaling n.
In Section
Craft

