Expand description
Random value generation and randomized truncation helpers.
These helpers use the thread-local generator for strings, indexes, shuffles, durations, and event identifiers. Range arguments use half-open semantics.
Functionsยง
- event_
id - Generates a Matrix event identifier from 32 random bytes.
- index
- Chooses a uniformly random index below
len. - secs
- Generates a
Durationwith a random whole-second length. - shuffle
- Randomly permutes a slice in place.
- string
- Generates an alphanumeric ASCII string of the requested byte length.
- string_
array - Generates an alphanumeric ASCII string that fills a fixed-capacity array.
- string_
from - Generates a string of
lengthcharacters sampled fromcharset. - time_
from_ now_ secs - Adds a random whole-second offset to the current
SystemTime. - truncate_
str - Borrows a prefix ending at a randomly selected character count.
- truncate_
string - Truncates an owned string at a randomly selected character count.