Skip to main content

generate

Function generate 

Source
pub fn generate(
    t: &Template,
    o: &Options,
    ctx: &Ctx,
    rng: &mut dyn Draw,
) -> Result<Generated, String>
Expand description

Makes a password from t. The random draws come from rng; everything else from ctx.

Constraints are met by rejection sampling, so every accepted draw stays uniform. A droppable token is removed (highest priority number first) when a maximum length cannot otherwise be met. If the random bits fall below the floor, nothing is generated: a hostile page that declares a short maximum cannot steer the result to a weak password.