      SUBROUTINE FCOOLR(NTI,F,RIND)
      COMPLEX F(32768),X(32768),TEMP,THETA
      N=2**NTI
      DO 1 I=1,N
      X(I)=F(I)
    1 CONTINUE
C     DO 2 I=N/2+1,N
C     X(I)=(0.,0.)
C   2 CONTINUE
      J=1
      DO 140 I=1,N
      IF(I.GE.J) GO TO 110
      TEMP=X(J)
      X(J)=X(I)
      X(I)=TEMP
  110 M=N/2
  120 IF(J.LE.M) GO TO 130
      J=J-M
      M=M/2
      IF(M.GE.2) GO TO 120
  130 J=J+M
  140 CONTINUE
      KMAX=1
  150 IF(KMAX.GE.N) GO TO 9
      ISTEP=KMAX*2
      DO 170 K=1,KMAX
      THETA=CMPLX(0.,3.141593*REAL(RIND*(K-1))/REAL(KMAX))
c      THETA=(0.,3.141593*REAL(RIND*(K-1))/REAL(KMAX))
      DO 160 I=K,N,ISTEP
      J=I+KMAX
      TEMP=X(J)*CEXP(THETA)
c      TEMP=X(J)*EXP(THETA)
      X(J)=X(I)-TEMP
      X(I)=X(I)+TEMP
  160 CONTINUE
  170 CONTINUE
      KMAX=ISTEP
      GO TO 150
    9 CONTINUE
      DO 5 I=1,N
      F(I)=X(I)
    5 CONTINUE
      RETURN
      END


