pub struct Noise { /* private fields */ }Expand description
Provides way to generate some noise to floating point value.
Implementations§
Source§impl Noise
impl Noise
Sourcepub fn new_with_addition(
probability: f64,
range: (f64, f64),
random: Arc<dyn Random>,
) -> Noise
pub fn new_with_addition( probability: f64, range: (f64, f64), random: Arc<dyn Random>, ) -> Noise
Creates a new instance of Noise which will add some noise in given range
to the target value: value = value + value * sample_from(range)
Sourcepub fn new_with_ratio(
probability: f64,
range: (f64, f64),
random: Arc<dyn Random>,
) -> Noise
pub fn new_with_ratio( probability: f64, range: (f64, f64), random: Arc<dyn Random>, ) -> Noise
Creates a new instance of Noise which will apply noise by multiplying target value
by value from given range: value = value * sample_from(range)
Sourcepub fn generate_multi<'a, Iter>(
&'a self,
values: Iter,
) -> impl Iterator<Item = f64> + 'a
pub fn generate_multi<'a, Iter>( &'a self, values: Iter, ) -> impl Iterator<Item = f64> + 'a
Generates an iterator with noise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Noise
impl !RefUnwindSafe for Noise
impl Send for Noise
impl Sync for Noise
impl Unpin for Noise
impl !UnwindSafe for Noise
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more