pub fn random_sample(
sample_length: usize,
sample_string: &str,
) -> Result<String, Box<dyn Error>>Expand description
Generates a random sample of characters from a given string.
§Parameters
sample_length: The number of characters to sample.sample_string: The string from which to sample characters.
§Returns
A String containing the sampled characters.
§Errors
Returns an error if sample_length is negative or if sample_string is empty.
§Example
use keeper_secrets_manager_core::utils::random_sample;
let result = random_sample(10, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789").unwrap();
println!("Random Sample: {}", result);