Alphanumeric: document usage with DistString trait
This commit is contained in:
parent
c831b8dd3b
commit
e64df6631e
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user