Skip to main content

password

Function password 

Source
pub fn password(length: usize) -> String
Expand description

Generates a random password of length characters from letters, digits, and symbols.

When length is 3 or more, the password has at least one of each.

let password = laravel::str::password(32);

assert_eq!(password.chars().count(), 32);
assert!(password.chars().any(|c| c.is_ascii_digit()));

§Panics

Panics when the operating system can’t provide random bytes.