add testutil module

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
This commit is contained in:
Erik Hollensbe 2022-06-26 12:42:48 -07:00
parent 8ddd287787
commit 76c1e62014
No known key found for this signature in database
GPG key ID: 4BB0E241A863B389

View file

@ -0,0 +1,4 @@
// from zeronsd
pub fn randstring(len: u8) -> String {
(0..len).map(|_| (rand::random::<u8>() % 26) + 'a' as u8).map(|c| if rand::random::<bool>() { (c as char).to_ascii_uppercase() } else { c as char }).map(|c| c.to_string()).collect::<Vec<String>>().join("")
}