Function generate_os_secure

Source
pub fn generate_os_secure(length: usize, charset: &[u8]) -> String
Expand description

Generates a secure random string with OsRng of a specified length using a given character set.

§Arguments

  • length - The length of the generated string.
  • charset - A slice of bytes representing the character set to use for generating the string.

§Returns

A String containing randomly selected characters from the provided character set.

§Examples

use advanced_random_string::{charset, random_string};

let random_string = random_string::generate_os_secure(10, charset::BASE62);
println!("Generated string: {}", random_string);