      subroutine su2_a0nhit(nhit,alpha,a0,lacpt) 
C Alexei Bazavov Mar 11, 2006; Bernd Berg Dec 5, 2008.
c Generates a0 with improved algorithm (FHKP).
C Accepts or rejects this proposal (lacpt).
c alpha - parameter of distribution,
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      lacpt=.false.
      do ihit=1,nhit
        call ranmar(xr1)
        call ranmar(xr2)
        call ranmar(xr3)
        call ranmar(xr4)
        x=-log(one-xr1)/alpha
        c=(cos(2*pi*xr3))**2
        xp=-log(one-xr2)/alpha
        a0trial=xp+x*c
        if((xr4*xr4).le.(one-a0trial/two)) then
          a0=one-a0trial
          lacpt=.true.
        endif
      enddo
      return
      end
