start rand utils suite

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk committed 2024-07-04 21:06:35 +00:00
1 parent 25c004f08c
commit 4f5c6de853
3 files changed
+28 -12

No files matched your search

-10
View File
@@ -1,15 +1,5 @@
use rand::prelude::*;
use crate::Result;
pub fn random_string(length: usize) -> String {
thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
.take(length)
.map(char::from)
.collect()
}
/// Parses the bytes into a string.
#[inline]
pub fn string_from_bytes(bytes: &[u8]) -> Result<String> {