1use rand::prelude::*;
2
3pub fn bprintln(solution: String) {
4 let time = std::time::Duration::from_millis(5);
5 let mut tmp = [0; 4];
6 let mut i: usize = 0;
7 let mut start = "".to_string();
8 let alphabet = vec![
9 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
10 "s", "t", "u", "v", "w", "x", "y", "z", " ", "A", "B", "C", "D", "E", "F", "G", "H", "I",
11 "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "!",
12 "@", "#", "$", "%", "^", "/", "&", "*", "(", ")", "-", "_", "=", "+", ".", ",", "?", "~",
13 "`", "|", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
14 ];
15 let mut rng = thread_rng();
16 while start != solution {
17 let holder = alphabet.choose(&mut rng).unwrap();
18 if holder != &solution.chars().nth(i).unwrap().encode_utf8(&mut tmp) {
19 println!("{}{}", start, holder);
20 std::thread::sleep(time);
21 } else {
22 start = format!("{}{}", start, holder);
23 println!("{}", start);
24 i += 1;
25 std::thread::sleep(time);
26 };
27 }
28}
29