function myPi = mcPi(N, L)
% Estimate pi by throwing N darts at an LxL board

hits= 0;
for k = 1:N
   % Throw kth dart
   x= rand()*L - L/2;
   y= rand()*L - L/2;

   % Count it if it is in the circle
   if sqrt(x^2 + y^2) <= L/2
      hits= hits + 1;
   end
end

myPi= 4*hits/N;
