Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Golf -- compute PI

by lhoward (Vicar)
on Apr 16, 2002 at 01:39 UTC ( [id://159385]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for(1..999999){$x=rand();$y=rand();$k++if sqrt($x*$x+$y*$y)<1}print 4*
    +$k/999999
    
  2. or download this
    for(1..1e6){$k++if sqrt(rand()**2+rand()**2)<1}print $k*4/1e6
    

Log In?
Username:
Password:

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

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

    No recent polls found