*   SROT.FOR
*
      SUBROUTINE SROT(PR,TEMP,IDF)

      COMMON /CONST / PI,SPI,BOLTZ

*--selects a typical equuilibrium value of the rotational energy PR at
*----the temperature TEMP in a gas with IDF rotl. deg. of f.
*
      IF (IDF.EQ.2) THEN
        PR=-LOG(RND())*BOLTZ*TEMP
*--for 2 degrees of freedom, the sampling is directly from eqn (11.19)
      ELSE
*--otherwise apply the acceptance-rejection method to eqn (11.20)
        A=0.5*IDF-1.
50      ERM=RND()*10.
*--the cut-off internal energy is 10 kT
        B=((ERM/A)**A)*EXP(A-ERM)
        IF (B.LT.RND()) GO TO 50
        PR=ERM*BOLTZ*TEMP
      END IF
      RETURN
      END
