Struct qwerty::ascii::Ascii [−][src]
pub struct Ascii;
Sample a char
, uniformly distributed over ASCII letters, numbers, and symbols:
a-z, A-Z, 0-9 and !"#$%&'()*+,-./:;<=>?@`~[]{}^_| .
Example
use std::iter; use rand::{Rng, thread_rng}; use qwerty::ascii::Ascii; let mut rng = thread_rng(); let chars: String = iter::repeat(()) .map(|()| rng.sample(Ascii)) .take(7) .collect(); println!("Random chars: {}", chars);
Trait Implementations
impl Debug for Ascii
[src]
impl Debug for Ascii
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Distribution<char> for Ascii
[src]
impl Distribution<char> for Ascii
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> char
[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> char
Generate a random value of T
, using rng
as the source of randomness.
fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
R: Rng,
[src]
fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as the source of randomness. Read more