pub struct Rng { /* private fields */ }Expand description
Deterministic, seedable RNG shared by all fcmaes optimizers.
Implementations§
Source§impl Rng
impl Rng
Sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Seed from a single 64-bit value (convenience for seed/runid pairs).
Sourcepub fn from_state_stream(state: u128, stream: u128) -> Self
pub fn from_state_stream(state: u128, stream: u128) -> Self
Seed from a full 128-bit state + stream selector.
Sourcepub fn normreal(&mut self, mu: f64, sdev: f64) -> f64
pub fn normreal(&mut self, mu: f64, sdev: f64) -> f64
Draw a normal value with mean mu and standard deviation sdev.
Sourcepub fn int_below(&mut self, max: i64) -> i64
pub fn int_below(&mut self, max: i64) -> i64
Draw an integer in [0, max) by scaling a uniform value.
Returns zero when max <= 0.
Sourcepub fn uniform_vec(&mut self, dim: usize) -> Vec<f64>
pub fn uniform_vec(&mut self, dim: usize) -> Vec<f64>
Vector of dim uniform [0, 1) samples.
Sourcepub fn normal_vec(&mut self, dim: usize) -> Vec<f64>
pub fn normal_vec(&mut self, dim: usize) -> Vec<f64>
Vector of dim standard-normal samples.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnsafeUnpin for Rng
impl UnwindSafe for Rng
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.