pub struct UnitSphereSurface;
Samples uniformly from the surface of the unit sphere in three dimensions.
Implemented via a method by Marsaglia1.
use rand::distributions::{UnitSphereSurface, Distribution};
let sphere = UnitSphereSurface::new();
let v = sphere.sample(&mut rand::thread_rng());
println!("{:?} is from the unit sphere surface.", v)
Construct a new UnitSphereSurface
distribution.
Generate a random value of T
, using rng
as the source of randomness.
Important traits for DistIter<'a, D, R, T>
impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
Create an iterator that generates random values of T
, using rng
as the source of randomness. Read more
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
Numeric cast from T
to Self
.
Numeric cast from self
to T
.
Safe lossless bitwise transmute from T
to Self
.
Safe lossless bitwise transmute from self
to T
.