      program r16807
      rinv=0.5/(2.**31-1)
      ibm=4711333
      do i=1,1000
      ibm=ibm*16807
      enddo
      rold=0.
      rnew=0.
      do i=1,10000
100   rold=rnew
      ibm=ibm*16807
      rnew=float(ibm)*rinv+0.5
      if(rold.lt.0.001.and.rnew.lt.0.001) then
      write(*,*) rold,rnew
      else
      goto 100
      endif
      enddo
      end
     
