Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Golf -- compute PI

by lhoward (Vicar)
on Apr 16, 2002 at 01:39 UTC ( #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
Node Status?
node history
Node Type: note [id://159385]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2020-12-04 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?