pub struct Ball {
pub radius: PositiveReal,
}Expand description
A uniform distribution of all points inside or on a sphere with radius r.
§Example
use hoomd_vector::{Cartesian, distribution::Ball};
use rand::{Rng, SeedableRng, distr::Distribution, rngs::StdRng};
let mut rng = StdRng::seed_from_u64(1);
let r = 5.0;
let ball = Ball {
radius: r.try_into()?,
};
let v: Cartesian<3> = ball.sample(&mut rng);Fields§
§radius: PositiveRealThe radius of the ball ([length]).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ball
impl<'de> Deserialize<'de> for Ball
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize> Distribution<Cartesian<N>> for Ball
impl<const N: usize> Distribution<Cartesian<N>> for Ball
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Cartesian<N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Cartesian<N>
Generate a random value of
T, using rng as the source of randomness.§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>where
R: Rng,
Self: Sized,
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>where
R: Rng,
Self: Sized,
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreimpl StructuralPartialEq for Ball
Auto Trait Implementations§
impl Freeze for Ball
impl RefUnwindSafe for Ball
impl Send for Ball
impl Sync for Ball
impl Unpin for Ball
impl UnwindSafe for Ball
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more