SmallRngRef

Struct SmallRngRef 

Source
pub struct SmallRngRef<'a>(/* private fields */);

Trait Implementations§

Source§

impl<'a> From<&'a mut SmallRng> for SmallRngRef<'a>

Source§

fn from(rng: &mut SRNG) -> SmallRngRef<'_>

Converts to this type from the input type.
Source§

impl<'a> RandomNumberGenerator for SmallRngRef<'a>

Source§

fn rf64(&mut self) -> f64

Generates a uniform number in [0.0, 1.0)
Source§

fn ru32(&mut self) -> u32

Source§

fn ru32_to(&mut self, b: u32) -> u32

Draws a number from {0, …, b-1}
Source§

fn ru32_in(&mut self, a: u32, b: u32) -> Option<u32>

Draws a number from {a, …, b-1}
Source§

fn ri32(&mut self) -> i32

Source§

fn ri32_in(&mut self, a: i32, b: i32) -> Option<i32>

Draws a number from {a, …, b-1}
Source§

fn ru64(&mut self) -> u64

Source§

fn ru64_to(&mut self, b: u64) -> u64

Draws a number from {0, …, b-1}
Source§

fn ru64_in(&mut self, a: u64, b: u64) -> Option<u64>

Draws a number from {a, …, b-1}
Source§

fn ri64(&mut self) -> i64

Source§

fn ri64_in(&mut self, a: i64, b: i64) -> Option<i64>

Draws a number from {a, …, b-1}
Source§

fn rusize(&mut self) -> usize

Source§

fn rusize_to(&mut self, b: usize) -> usize

Draws a number from {0, …, b-1}
Source§

fn rusize_in(&mut self, a: usize, b: usize) -> Option<usize>

Draws a number from {a, …, b-1}
Source§

fn rf64_to(&mut self, b: f64) -> Option<f64>

Generates a uniform number in [0.0, b)
Source§

fn rf64_in(&mut self, a: f64, b: f64) -> Option<f64>

Generates a uniform number in [a, b)
Source§

fn rbern(&mut self, p: f64) -> Option<bool>

Returns true with probability p.
Source§

fn relement<'t, T>(&mut self, slice: &'t [T]) -> Option<&'t T>

Returns a random element of a vector
Source§

fn one_of_f64(&mut self, p0: f64, p1: f64) -> Option<bool>

Returns Some(true) with probability p1 / (p0 + p1) for two positive numbers. Returns None if any number is negative, or if both are zero.

Auto Trait Implementations§

§

impl<'a> Freeze for SmallRngRef<'a>

§

impl<'a> RefUnwindSafe for SmallRngRef<'a>

§

impl<'a> Send for SmallRngRef<'a>

§

impl<'a> Sync for SmallRngRef<'a>

§

impl<'a> Unpin for SmallRngRef<'a>

§

impl<'a> !UnwindSafe for SmallRngRef<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V