reto03 14062023 17:48
This commit is contained in:
@@ -7,19 +7,25 @@
|
|||||||
* - Con o sin símbolos.
|
* - Con o sin símbolos.
|
||||||
* (Pudiendo combinar todos estos parámetros entre ellos)
|
* (Pudiendo combinar todos estos parámetros entre ellos)
|
||||||
*/
|
*/
|
||||||
use rand::Rng; // 0.8.5
|
use rand::Rng;
|
||||||
//
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut ch: char = 'A';
|
// configurar:
|
||||||
|
let veces = 13;
|
||||||
|
let letras_mayusculas = true;
|
||||||
|
let numeros = true;
|
||||||
|
let simbolos = true;
|
||||||
|
|
||||||
println!("ASCII value: {}", ch as u32);
|
let mut caracteres = String::from_utf8((b'a'..=b'z').collect()).unwrap();
|
||||||
|
if letras_mayusculas {
|
||||||
ch = '&';
|
let vector_mayusculas = String::from_utf8((b'A'..=b'Z').collect()).unwrap();
|
||||||
println!("ASCII value: {}", ch as u32);
|
caracteres += vector_mayusculas.to_string().as_str();
|
||||||
|
}
|
||||||
ch = 'X';
|
let mut texto: String = String::new();
|
||||||
println!("ASCII value: {}", ch as u32);
|
for _ in 0..veces {
|
||||||
|
let num: u8 = rand::thread_rng().gen_range(33..127);
|
||||||
let num: u8 = rand::thread_rng().gen_range(0..255);
|
let caracter = num as char;
|
||||||
println!("{}", num as char);
|
texto += &caracter.to_string();
|
||||||
|
}
|
||||||
|
println!("{}", texto.to_string());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user