Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Golf -- compute PI

by Dr. Mu (Hermit)
on Apr 22, 2002 at 07:00 UTC ( [id://161008]=note: print w/replies, xml ) Need Help??


in reply to Golf -- compute PI

Here's a Monte Carlo prog that weighs in at 42:
die grep(rand()**2+rand()**2<1,1..4e6)/1e6
(I don't claim it's pretty, converges fast, scrimps on memory, or produces repeatable results.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://161008]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-28 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found