Function string

Source
pub fn string(length: Length) -> String
Expand description

Generates random strings of length characters from the CHARS set.

§Panics

This function will not panic, as detailed below.

§Distribution

The uniform distribution is created with constantly checked LENGTH being non-zero.

§Bounds

CHARS is the array containing exactly LENGTH characters. Since the uniform range is exclusive, the sampled index will always be in the bounds of the array.

§Feature

Moreover, the unsafe-assert feature can be enabled to assume the bounds are correct.