10 lines
225 B
Rust
10 lines
225 B
Rust
|
use rand::{distributions::Alphanumeric, Rng};
|
||
|
|
||
|
pub fn gen_alphanumeric(length: usize) -> String {
|
||
|
rand::thread_rng()
|
||
|
.sample_iter(&Alphanumeric)
|
||
|
.take(length)
|
||
|
.map(char::from)
|
||
|
.collect()
|
||
|
}
|