      program pi_v1 ! Bernd Berg Sep 6 2005.
c pi estimate - version 1.
      include '../../ForLib/implicit.sta'
      include '../../ForLib/constants.par'
      parameter(iuo=6,iud=10,iseed1=0,iseed2=0,ndat=10**6)
c
      write(iuo,'(/," pi =",1F10.5)') pi
      call rmaset(iuo,iud,iseed1,iseed2,'ranmar.d')
      events=zero
      do idat=1,ndat
        call ranmar(xr)
        call ranmar(yr)
	if(xr**2+yr**2.lt.one) events=events+one
      end do
      pi_est=4*events/ndat
      write(iuo,'(/," pi estimate =",1F10.5)') pi_est
c
      stop
      end

      include '../../ForLib/rmaset.f'
      include '../../ForLib/ranmar.f'
      include '../../ForLib/rmasave.f'
