Last active
July 6, 2021 16:02
-
-
Save lunandd/d709570ee85ddca730d5762e527c0eb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand; | |
use rand::distributions::{Distribution, Uniform}; | |
fn rand_string(amount: u32) -> String { | |
let mut rng = rand::thread_rng(); | |
let random = Uniform::from(30..=800); | |
(1..=amount).map(|_| char::from_u32(random.sample(&mut rng)).unwrap()).collect::<String>() | |
} | |
fn main() { | |
for _ in 1..=100 { | |
println!("{}", rand_string(15)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment