use rand::{Rng, distr::Alphanumeric};
pub const WORD_LIST: [&str; 20] = [
"apple",
"banana",
"cherry",
"date",
"elderberry",
"fig",
"grape",
"honeydew",
"kiwi",
"lemon",
"mango",
"nectarine",
"orange",
"peach",
"quince",
"raspberry",
"strawberry",
"tangerine",
"watermelon",
"zucchini",
];
pub fn generate_random_string(len: usize) -> String {
rand::rng()
.sample_iter(&Alphanumeric)
.take(len)
.map(char::from)
.collect()
}
pub fn generate_test_data(count: usize) -> Vec<String> {
(0..count).map(|_| generate_random_string(32)).collect()
}
pub fn format_file_size(size: u64) -> String {
const KB: u64 = 1024;
const MB: u64 = KB * 1024;
const GB: u64 = MB * 1024;
if size >= GB {
format!("{:.2} GB", size as f64 / GB as f64)
} else if size >= MB {
format!("{:.2} MB", size as f64 / MB as f64)
} else if size >= KB {
format!("{:.2} KB", size as f64 / KB as f64)
} else {
format!("{} bytes", size)
}
}