pub fn bytes(n: usize) -> Result<Vec<u8>, String>
Generates a random string of length “n”.
8 9 10 11 12 13 14 15
pub fn string(n: usize) -> String { let bytes = bytes(n).unwrap(); let mut d = bs58::encode(&bytes[..]).into_string(); if n > 0 && d.len() > n { d.truncate(n); } d }