random.vonmisesvariate(mu, kappa)
The random.vonmisesvariate function returns a random number drawn from a von Mises distribution, also known as a circular normal distribution or Tikhonov distribution.
- mu: Mean angle expressed in radians between 0 and 2π.
- kappa: Concentration parameter. It must be greater than or equal to 0.
The random.vonmisesvariate function returns a real number.
We can generate a random number extracted from a von Mises distribution with a mean angle equal to 5 and with a concentration parameter equal to 1 with the following code:
To confirm the distribution from which the random numbers are extracted, we can generate one hundred thousand random numbers from a von Mises distribution with a mean angle equal to 5 and with a concentration parameter equal to 1 and show its histogram:
plt.hist([random.vonmisesvariate(5, 1) for i in range(100000)], bins = 100)
plt.grid()
plt.show()