c234567
       program corr
       common /pawc/h(200000)
       dimension cphi(8),c2phi(8)
       character*4 char(1)
       data cphi /-.070,-.045,-.031,-.013,
     1 .0015,.0108,.0115,.0036/
       data c2phi/.0033,.0044,.0069,.0096,
     1 .0124, .0161,.0181,.0150/

       call hlimit(200000)
c234567
      call hbook1(830,' cphi 5 4.5    ',100,-1.,1.,0.)
      call hbook1(831,' cphi 4.5 4    ',100,-1.,1.,0.)
      call hbook1(832,' cphi 4   3.5  ',100,-1.,1.,0.)
      call hbook1(833,' cphi 3.5 3    ',100,-1.,1.,0.)
      call hbook1(834,' cphi 3   2.5  ',100,-1.,1.,0.)
      call hbook1(835,' cphi 2.5 2    ',100,-1.,1.,0.)
      call hbook1(836,' cphi 2   1.5  ',100,-1.,1.,0.)
      call hbook1(837,' cphi 1.5 1    ',100,-1.,1.,0.)
      call hbook1(838,' cphi 1   .5   ',100,-1.,1.,0.)
      call hbook1(839,' cphi .5  0.   ',100,-1.,1.,0.)
      call hbook1(840,' c2phi        ',100,-1.,1.,0.)
      call hbook1(841,' c2phi        ',100,-1.,1.,0.)
      call hbook1(842,' c2phi        ',100,-1.,1.,0.)
      call hbook1(843,' c2phi        ',100,-1.,1.,0.)
      call hbook1(844,' c2phi        ',100,-1.,1.,0.)
      call hbook1(845,' c2phi        ',100,-1.,1.,0.)
      call hbook1(846,' c2phi        ',100,-1.,1.,0.)
      call hbook1(847,' c2phi        ',100,-1.,1.,0.)
      call hbook1(848,' c2phi        ',100,-1.,1.,0.)
      call hbook1(849,' c2phi        ',100,-1.,1.,0.)


      do iloop =1,1000000
      do i = 1,8
      a = 1.0
      b = cphi(i)
      c= c2phi(i)     

      phimax = abs(a)+abs(2.*b)+abs(2.*c) 
 100  phi = 6.2832*rndm(1)
      if( (a+2.*b*cos(phi)+2.*c*cos(2.*phi)).lt.
     1 rndm(1)*phimax) goto100

      c1 = cos(phi)
      c2 = cos(2.*phi)
      call hfill(829+i,c1,0.,1.)
      call hfill(839+i,c2,0.,1.)
      enddo
      enddo

      call histdo(0)
      call hplint(0)
      char(1)='STA'
      call hplopt(char,1)
      call hplcap(-10)
      call hplot(0,' ',' ',0)
      call hplend
      call hrput(0,'corr.rz','n')


      stop
      end

