program dos_1D
   implicit none
   REAL, PARAMETER :: TWOPI=6.283185307179
   integer,parameter::N=100,M=10000
   integer::i,j
   real::r,k,emax,emin,eps
   integer::histrho(-1000:1000)
   histrho=0
   do i=1,M
      call random_number(r)
      k=TWOPI*(r-0.5)
      eps=-cos(k)
      eps=N*eps
      eps=INT(eps)
      histrho(eps)=histrho(eps)+1
   enddo
   open(12,file='tbdos1d.dat') 
   do j=-100,100
      eps=(2.0*j-N-1.0)/real(N-1)
      write(12,*) eps, histrho(j)
   enddo
   close(12)
end program
