#!/usr/bin/env ruby
# -*- coding:utf-8 -*-
def pi(num)
  in_circle=0
  num.times do
    srand()
    x = rand()
    y = rand()
    if x*x+y*y<=1
      in_circle+=1
    end
  end
  pi=(in_circle/num.to_f)*4
  return(pi)
end
puts(pi(10000))
