Skip to main content

Crate guise_choice

Crate guise_choice 

Source
Expand description

Uniform random selection and stealth-safe token primitives.

This crate owns the empty-domain and alphabet contracts for random choices used by stealth consumers. The APIs avoid modulo-biased sampling and return None for invalid caller-supplied alphabets instead of panicking.

Structs§

StdRng
The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG).

Constants§

LOWER_ALPHANUMERIC
Lowercase ASCII letters plus digits.

Functions§

chance
Return true with the requested probability using thread-local entropy.
chance_with_rng
Return true with the requested probability using the caller’s RNG.
random_ascii_string
Generate an ASCII string from a caller-supplied alphabet using thread-local entropy.
random_ascii_string_with_rng
Generate an ASCII string from a caller-supplied alphabet using the caller’s RNG.
random_index
Sample a uniformly random index in 0..len.
random_index_with_rng
Sample a uniformly random index in 0..len using the caller’s RNG.
random_item
Sample a uniformly random item from a slice.
random_item_with_rng
Sample a uniformly random item from a slice using the caller’s RNG.
random_lower_alphanumeric
Generate a lowercase alphanumeric string using thread-local entropy.
random_lower_alphanumeric_with_rng
Generate a lowercase alphanumeric string using the caller’s RNG.
seed_from_u64
Convert a small integer seed into a full byte seed deterministically.
seeded_rng
Build a seeded StdRng from a byte seed.
seeded_rng_from_u64
Build a seeded StdRng from a small integer seed.
weighted_index
Sample an index from a non-negative finite weight slice.
weighted_index_by_with_rng
Sample an item index using weights projected from each item.
weighted_index_with_rng
Sample an index from a non-negative finite weight slice using the caller’s RNG.

Type Aliases§

Seed
A deterministic 32-byte seed for fleet-wide RNGs.