[−][src]Struct buf_rand::BufRand
used to generate random booleans using a bit buffer
Implementations
impl<R: RngCore> BufRand<R>[src]
pub fn new(rand: R) -> Self[src]
create a new BufRand which generates random booleans using the supplied rng
pub fn next_bool(&mut self) -> bool[src]
returns a random boolean from the buffer of this BufRand
use buf_rand::BufRand; let mut rand = BufRand::new(Box::new(rand::thread_rng())); rand.next_bool();
pub fn rand_char_case(&mut self, c: &char) -> String[src]
randomizes the capitalization of a char
this returns a String since some chars may result in multiple when the case is changed
such as this
//example of character turning into multiple assert_eq!('ß'.to_uppercase().to_string(), "SS"); use buf_rand::BufRand; let mut rand = BufRand::new(Box::new(rand::thread_rng())); rand.rand_char_case(&'E');
pub fn rand_string_case(&mut self, s: &str) -> String[src]
randomizes the capitalization of every character in the string
use buf_rand::BufRand; let mut rand = BufRand::new(Box::new(rand::thread_rng())); rand.rand_string_case("hello world!");
Trait Implementations
impl<R: RngCore> Deref for BufRand<R>[src]
type Target = R
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
allows borrowing the randomizer this BufRand uses
impl<R: RngCore> DerefMut for BufRand<R>[src]
Auto Trait Implementations
impl<R> RefUnwindSafe for BufRand<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for BufRand<R> where
R: Send,
R: Send,
impl<R> Sync for BufRand<R> where
R: Sync,
R: Sync,
impl<R> Unpin for BufRand<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for BufRand<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,