Struct irox_tools::random::Random

source ·
pub struct Random { /* private fields */ }
Expand description

Basic Random Number Generator based on the PCG-XSH-RR

Implementations§

source§

impl Random

source

pub fn new_seed(seed: u64) -> Random

Creates a random seeded with this number.

source

pub fn next_u32(&mut self) -> u32

Gets the next random u32 for this random sequence

source

pub fn next_u8(&mut self) -> u8

Gets the next random u8 for this random sequence

source

pub fn next_u16(&mut self) -> u16

Gets the next random u16 for this random sequence

source

pub fn next_u64(&mut self) -> u64

Gets the next random u64 for this random sequence

source

pub fn next_u128(&mut self) -> u128

Gets the next random u128 for this random sequence

source

pub fn next_f32(&mut self) -> f32

Gets the next random f32 for this random sequence

source

pub fn next_f64(&mut self) -> f64

Gets the next random f64 for this random sequence

Trait Implementations§

source§

impl Bits for Random

source§

fn read_u8(&mut self) -> Result<u8, Error>

source§

fn read_be_u16(&mut self) -> Result<u16, Error>

source§

fn read_be_u32(&mut self) -> Result<u32, Error>

source§

fn read_be_u64(&mut self) -> Result<u64, Error>

source§

fn read_be_u128(&mut self) -> Result<u128, Error>

source§

fn read_f32(&mut self) -> Result<f32, Error>

source§

fn read_f64(&mut self) -> Result<f64, Error>

source§

fn read_be_i16(&mut self) -> Result<i16, Error>

source§

fn read_be_i32(&mut self) -> Result<i32, Error>

source§

fn read_be_i64(&mut self) -> Result<i64, Error>

source§

fn advance(&mut self, len: usize) -> Result<usize, Error>

source§

impl Default for Random

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<T, U> MaybeInto<U> for T
where U: MaybeFrom<T>,

source§

fn maybe_into(self) -> Option<U>

source§

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

§

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>,

§

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<T> UUIDReader for T
where T: Bits,

source§

fn read_uuid(&mut self) -> Result<UUID, Error>

Attempts to read a UUID from this data source, returning the UUID read, or an error if it could not.