Struct rand_distr::UnitSphere [−][src]
pub struct UnitSphere;
Samples uniformly from the surface of the unit sphere in three dimensions.
Implemented via a method by Marsaglia1.
Example
use rand_distr::{UnitSphere, Distribution}; let v: [f64; 3] = UnitSphere.sample(&mut rand::thread_rng()); println!("{:?} is from the unit sphere surface.", v)
Marsaglia, George (1972). Choosing a Point from the Surface of a Sphere. Ann. Math. Statist. 43, no. 2, 645–646. ↩
Trait Implementations
impl Clone for UnitSphere
[src]
impl Clone for UnitSphere
[src]fn clone(&self) -> UnitSphere
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Float + SampleUniform> Distribution<[F; 3]> for UnitSphere
[src]
impl<F: Float + SampleUniform> Distribution<[F; 3]> for UnitSphere
[src]