pub struct Rand { /* private fields */ }
Expand description

Rand Struct

Implementations

Rand implementation

Create new Rand object

Examples
use randlib::Rand;

let mut rng = Rand::new();

Generate random value (u32)

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_number: u32 = rng.rand();

Generate random bool value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_bool: bool = rng.rand_bool();

Generate random u8 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_u8: u8 = rng.rand_u8();

Generate random u16 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_u16: u16 = rng.rand_u16();

Generate random u32 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_u32: u32 = rng.rand_u32();

Generate random u64 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_u64: u64 = rng.rand_u64();

Generate random u128 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_u128: u128 = rng.rand_u128();

Generate random i8 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_i8: i8 = rng.rand_i8();

Generate random i16 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_i16: i16 = rng.rand_i16();

Generate random i32 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_i32: i32 = rng.rand_i32();

Generate random i64 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_i64: i64 = rng.rand_i64();

Generate random i128 value

Examples
use randlib::Rand;

let mut rng = Rand::new();
let random_i128: i128 = rng.rand_i128();

Trait Implementations

Default Rand implementation

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.