Skip to main content

random_hex_string

Function random_hex_string 

Source
pub fn random_hex_string(len: usize) -> String
Available on crate feature tier2 only.
Expand description

Generate a random lowercase hex string (0-9, a-f) of exactly len characters.

Distinct from unique_hex: this function makes no uniqueness guarantee but draws each character uniformly from the hex alphabet.

§Example

use mod_rand::tier2;
let s = tier2::random_hex_string(32);
assert_eq!(s.len(), 32);