1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Generating random bytes and strings.
//!
//! This module provides two functions for generating random bytes and strings:
//! [`bytes`] and [`string`] accepting the desired length as [`Count`] and [`Length`] respectively.
//!
//! Because of the imposed length restrictions, the functions are safe to use
//! in the context of this crate. See [`count`] and [`length`] for more information.
//!
//! [`count`]: crate::count
//! [`length`]: crate::length
use assert_unchecked;
use ;
use crate::;
/// Generates `count` random bytes.
/// 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.