      function avonM(is,av,akappa)
c     implicit doubleprecision(a-h,o-q,s-z)
c     von Mises circular variate generator using 2-vec seed is
c     generate using acceptance/rejection method, with 0 <=r <=1,
c     -pi <= theta <= pi,  and accept iff
c                                r <= exp(alpha*(cos(theta)-1))  .
      dimension is(2)
      parameter         pi = 3.1415926536
      parameter      twopi = 6.2831853072
c     parameter deltatheta = 0.000001
      alpha = akappa
c                   equivalence,  permanent declaration
   10 continue
      ar     = random(is)
      theta = 2*pi*(random(is) - 0.5)
      if (ar .gt.  exp(alpha*(cos(theta-av)-1)))  goto 10
c     This acceptance/rejection code is a bit inefficient, particularly
c     if akappa is large.
      avonM = theta
      return
c
      end
