      SUBROUTINE TBMRNG(G,N)
      DIMENSION G(N)
      DATA PI2/6.2831853071796/
C     ------------------------------------------------------------------
C     NOTE...THE ARGUMENT D IN THE CALL LINE FOR RANF IS A DUMMY
C     ARGUMENT THAT IS REQUIRED BY THE CDC FUNCTION RANF.
C     ------------------------------------------------------------------
      DO 1 I = 1,N
      G(I) = RANF(D)
    1 CONTINUE
      M = N/2
      M = M + M
      L = N - M
      IF(L.EQ.0) GO TO 5
      GTEMP = RANF(D)
      IF(N.NE.1) GO TO 5
      TEMP1 = SQRT(-2.0*ALOG(G(1)))
      TEMP2 = COS(PI2*GTEMP)
      G(1) = TEMP1*TEMP2
      RETURN
    5 DO 10 I = 1,M,2
      TEMP1 = SQRT(-2.0*ALOG(G(I)))
      TEMP2 = PI2*G(I+1)
      G(I) = TEMP1*COS(TEMP2)
   10 G(I+1) = TEMP1*SIN(TEMP2)
      IF(L.EQ.0) RETURN
      TEMP1 = SQRT(-2.0*ALOG(G(N)))
      TEMP2 = PI2*GTEMP
      G(N) = TEMP1*COS(TEMP2)
      RETURN
      END
