SHARE
TWEET

pi

a guest May 29th, 2012 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env ruby
  2.  
  3. i = 0.0; c = 10000000
  4.  
  5. (0..c).each do |i2| i += 1 if rand**2 + rand**2 <= 1 end
  6.  
  7. puts i*4 / c
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top