Function rgsl::randist::spherical_vector::dir_nd
[−]
[src]
pub fn dir_nd(r: &Rng, x: &mut [f64])
This function returns a random direction vector v = (x_1,x_2,...,x_n) in n dimensions. The vector is normalized such that |v|2 = x_12 + x_22 + ... + x_n2 = 1. The method uses the fact that a multivariate Gaussian distribution is spherically symmetric. Each component is generated to have a Gaussian distribution, and then the components are normalized. The method is described by Knuth, v2, 3rd ed, p135–136, and attributed to G. W. Brown, Modern Mathematics for the Engineer (1956).