Generates pseudorandom numbers from a von mises distribution.
float *imsls_f_random_von_mises (int n_random, float c, …, 0)
The type double function is imsls_d_random_von_mises.
int n_random
(Input)
Number of random numbers to generate.
float c
(Input)
Parameter of the von Mises distribution. This parameter must be
greater than one-half of machine epsilon (On many machines, the lower bound for
c is 10−3).
An array of length n_random containing the random deviates of a von Mises distribution.
float
*imsls_f_random_von_mises (int n_random, float c,
IMSLS_RETURN_USER,
float r[],
0)
IMSLS_RETURN_USER, float r[]
(Output)
User-supplied array of length n_random containing
the random von mises deviates.
Function imsls_f_random_von_mises generates pseudorandom numbers from a von Mises distribution with parameter c, which must be positive. With c = c, the probability density function is
for −π < x < π, where I0 (c) is the modified Bessel function of the first kind of order 0. The probability density is equal to 0 outside the interval (−π, π).
The algorithm is an acceptance/rejection method using a wrapped Cauchy distribution as the majorizing distribution. It is due to Nest and Fisher (1979).
In this example, imsls_f_random_von_mises is used to generate five pseudorandom von Mises variates with c = 1.
imsls_random_seed_set(123457);
r = imsls_f_random_von_mises(n_random, c, 0);
imsls_f_write_matrix("Von Mises random deviates:",
1, n_random, r, IMSLS_NO_COL_LABELS, 0);
0.247 -2.433 -1.022 -2.172 -0.503
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |