      subroutine rang(xr) ! generic call. bernd berg apr 12 2007.
c pseudo random number generator. proposed by marsaglia, zaman and 
c tsang, stat. prob. 8 (1990) 35.
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      common/raset1/u(97),c,cd,cm,i,j
c
      uni=u(i)-u(j)
      if(uni.lt.zero) uni=uni+one
      u(i)=uni           
      i=i-1              
      if(i.eq.0) i=97    
      j=j-1              
      if(j.eq.0) j=97   
      c=c-cd            
      if(c.lt.zero) c=c+cm
      uni=uni-c
      if(uni.lt.zero) uni=uni+one
      xr=uni
c
      return
      end
