Skip to main content

random

Function random 

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

Generates a random string of length letters and digits.

let token = laravel::str::random(40);

assert_eq!(token.len(), 40);
assert!(token.chars().all(|c| c.is_ascii_alphanumeric()));

§Panics

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