Alphanumeric: document usage with DistString trait

This commit is contained in:
Diggory Hardy 2021-08-17 09:51:37 +01:00
parent c831b8dd3b
commit e64df6631e

View File

@ -40,6 +40,13 @@ use std::mem::{self, MaybeUninit};
/// println!("Random chars: {}", chars);
/// ```
///
/// Alternatively, one can use the [`DistString`] trait:
/// ```
/// use rand::distributions::{Alphanumeric, DistString};
/// let string = Alphanumeric.sample_string(&mut rand::thread_rng(), 16);
/// println!("Random string: {}", string);
/// ```
///
/// # Passwords
///
/// Users sometimes ask whether it is safe to use a string of random characters