program dos_1D
   implicit none
   REAL, PARAMETER :: pi=3.14159
   integer,parameter::N=100,M=1000000
   integer::i,j
   real::r,k,eps,qx,qy
   integer,dimension(N)::histrho
   histrho=0
   do i=1,M
      call random_number(qx)
      call random_number(qy)
      eps=sqrt(1.0+8.0*cos(pi*qx)*cos(pi*qy)*cos(pi*qx-pi*qy))
      j=(.5*(n+1)+(1.0/6.0)*(n-1)*eps)
      histrho(j)=histrho(j)+1
   enddo
   open(12,file='tbdos1d.dat') 
   do j=1,N
      eps=3.0*(2.0*j-N-1.0)/real(N-1)
      write(12,*) eps, histrho(j)
   enddo
   close(12)
end program
