Function rgsl::randist::spherical_vector::dir_3d
[−]
[src]
pub fn dir_3d(r: &Rng, x: &mut f64, y: &mut f64, z: &mut f64)
This function returns a random direction vector v = (x,y,z) in three dimensions. The vector is normalized such that |v|2 = x2 + y2 + z2 = 1. The method employed is due to Robert E. Knop (CACM 13, 326 (1970)), and explained in Knuth, v2, 3rd ed, p136. It uses the surprising fact that the distribution projected along any axis is actually uniform (this is only true for 3 dimensions).