pub fn generate_code<R: RandomSource>(
policy: &CodePolicy,
rng: &mut R,
) -> Result<PlainCode, RandomError>Expand description
Generate a fresh plaintext code under policy, drawing randomness from
rng.
The algorithm (RFC-003 §4): for each position, read one random byte; accept
it only if below the alphabet’s unbiased ceiling, then map
alphabet[byte % len]; otherwise discard and redraw.
§Errors
Returns RandomError if the RNG fails at any point. On error no code is
produced; there is no fallback (INV-3).