parameters: (self, mu, kappa)
return_statement: return theta
docstring: Circular data distribution.
  
          mu is the mean angle, expressed in radians between 0 and 2*pi, and
          kappa is the concentration parameter, which must be greater than or
          equal to zero.  If kappa is equal to zero, this distribution reduces
          to a uniform random angle over the range 0 to 2*pi.
docstring_summary: Circular data distribution.
docstring_tokens: Circular data distribution .
function: def vonmisesvariate(self, mu, kappa):
          """Circular data distribution.
  
          mu is the mean angle, expressed in radians between 0 and 2*pi, and
          kappa is the concentration parameter, which must be greater than or
          equal to zero.  If kappa is equal to zero, this distribution reduces
          to a uniform random angle over the range 0 to 2*pi.
  
          """
          # mu:    mean angle (in radians between 0 and 2*pi)
          # kappa: concentration parameter kappa (>= 0)
          # if kappa = 0 generate uniform random angle
  
          # Based upon an algorithm published in: Fisher, N.I.,
          # "Statistical Analysis of Circular Data", Cambridge
          # University Press, 1993.
  
          # Thanks to Magnus Kessler for a correction to the
          # implementation of step 4.
  
          random = self.random
          if kappa <= 1e-6:
              return TWOPI * random()
  
          s = 0.5 / kappa
          r = s + _sqrt(1.0 + s * s)
  
          while 1:
              u1 = random()
              z = _cos(_pi * u1)
  
              d = z / (r + z)
              u2 = random()
              if u2 < 1.0 - d * d or u2 <= (1.0 - d) * _exp(d):
                  break
  
          q = 1.0 / r
          f = (q + z) / (1.0 + q * z)
          u3 = random()
          if u3 > 0.5:
              theta = (mu + _acos(f)) % TWOPI
          else:
              theta = (mu - _acos(f)) % TWOPI
  
          return theta
function_tokens: def vonmisesvariate ( self , mu , kappa ) : # mu:    mean angle (in radians between 0 and 2*pi) # kappa: concentration parameter kappa (>= 0) # if kappa = 0 generate uniform random angle # Based upon an algorithm published in: Fisher, N.I., # "Statistical Analysis of Circular Data", Cambridge # University Press, 1993. # Thanks to Magnus Kessler for a correction to the # implementation of step 4. random = self . random if kappa <= 1e-6 : return TWOPI * random ( ) s = 0.5 / kappa r = s + _sqrt ( 1.0 + s * s ) while 1 : u1 = random ( ) z = _cos ( _pi * u1 ) d = z / ( r + z ) u2 = random ( ) if u2 < 1.0 - d * d or u2 <= ( 1.0 - d ) * _exp ( d ) : break q = 1.0 / r f = ( q + z ) / ( 1.0 + q * z ) u3 = random ( ) if u3 > 0.5 : theta = ( mu + _acos ( f ) ) % TWOPI else : theta = ( mu - _acos ( f ) ) % TWOPI return theta