program hit
   implicit none
   !call calcpi()
   call rantest()
end program

subroutine rantest()
   implicit none
   integer::i,N
   real::x,y
   open(10,file="rantest.dat")
   N=5000
   do i=1,N
      call random_number(x)
      call random_number(y)
      write(10,*) x,y
   enddo
   close(10)
end subroutine

subroutine calcpi()
   implicit none
   integer::i,N,N0
   real::x,y,r,mypi
   open(20,file="mypi.dat")
   do N=1000,100000,1000
      N0=0
      do i=1,N
         call random_number(x)
         call random_number(y)
         r=sqrt(x**2.0+y**2.0)
         if (r<1) N0=N0+1
      enddo
      mypi=4.0*N0/real(N)
      write(20,*) N,mypi
   enddo
   close(20)
end subroutine
