Struct ThreadLocalRand

Source
pub struct ThreadLocalRand(/* private fields */);
Expand description

A seeded, thread-local Rand instance.

Trait Implementations§

Source§

impl Rand for ThreadLocalRand

Source§

fn next_u16(&mut self) -> u16

Returns the next random u16.
Source§

fn next_u32(&mut self) -> u32

Returns the next random u32.
Source§

fn next_u64(&mut self) -> u64

Returns the next random u64.
Source§

fn next_u128(&mut self) -> u128

Returns the next random u128.
Source§

fn next_usize(&mut self) -> usize

Returns the next random usize.
Source§

fn next_bool(&mut self, p: Probability) -> bool

Returns a bool with a probability p of being true. Read more
Source§

fn next_lim_u16(&mut self, lim: u16) -> u16

Generates a random number in 0..lim.
Source§

fn next_lim_u32(&mut self, lim: u32) -> u32

Generates a random number in 0..lim.
Source§

fn next_lim_u64(&mut self, lim: u64) -> u64

Generates a random number in 0..lim.
Source§

fn next_lim_u128(&mut self, lim: u128) -> u128

Generates a random number in 0..lim.
Source§

fn next_lim_usize(&mut self, lim: usize) -> usize

Generates a random number in 0..lim.

Auto Trait Implementations§

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<R> RandLim<u128> for R
where R: Rand,

Source§

fn next_lim(&mut self, lim: u128) -> u128

Generates a random number in 0..N.
Source§

impl<R> RandLim<u16> for R
where R: Rand,

Source§

fn next_lim(&mut self, lim: u16) -> u16

Generates a random number in 0..N.
Source§

impl<R> RandLim<u32> for R
where R: Rand,

Source§

fn next_lim(&mut self, lim: u32) -> u32

Generates a random number in 0..N.
Source§

impl<R> RandLim<u64> for R
where R: Rand,

Source§

fn next_lim(&mut self, lim: u64) -> u64

Generates a random number in 0..N.
Source§

impl<R> RandLim<usize> for R
where R: Rand,

Source§

fn next_lim(&mut self, lim: usize) -> usize

Generates a random number in 0..N.
Source§

impl<R> RandRange<Duration> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<Duration>) -> Duration

Generates a random number in the given range.
Source§

impl<R> RandRange<u128> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<u128>) -> u128

Generates a random number in the given range.
Source§

impl<R> RandRange<u16> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<u16>) -> u16

Generates a random number in the given range.
Source§

impl<R> RandRange<u32> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<u32>) -> u32

Generates a random number in the given range.
Source§

impl<R> RandRange<u64> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<u64>) -> u64

Generates a random number in the given range.
Source§

impl<R> RandRange<usize> for R
where R: Rand,

Source§

fn next_range(&mut self, range: Range<usize>) -> usize

Generates a random number in the given range.
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.