Trait rand::distributions::DistString[][src]

pub trait DistString {
    fn append_string<R: Rng + ?Sized>(
        &self,
        rng: &mut R,
        string: &mut String,
        len: usize
    ); fn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String { ... } }

String sampler

Sampling a String of random characters is not quite the same as collecting a sequence of chars. This trait contains some helpers.

Required methods

fn append_string<R: Rng + ?Sized>(
    &self,
    rng: &mut R,
    string: &mut String,
    len: usize
)
[src]

Append len random chars to string

Loading content...

Provided methods

fn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String[src]

Generate a String of len random chars

Loading content...

Implementors

impl DistString for Alphanumeric[src]

impl DistString for Standard[src]

Note: the String is potentially left with excess capacity; optionally the user may call string.shrink_to_fit() afterwards.

Loading content...