Update Rust to 1.84.1 (#5508)

- also update the crates
- add necessary modifications for `rand` upgrade
- `small_rng` is enabled by default now
This commit is contained in:
Daniel
2025-02-01 14:16:32 +02:00
committed by GitHub
parent 3c29f82974
commit 1109293992
8 changed files with 167 additions and 85 deletions

View File

@@ -56,11 +56,11 @@ pub fn encode_random_bytes<const N: usize>(e: Encoding) -> String {
pub fn get_random_string(alphabet: &[u8], num_chars: usize) -> String {
// Ref: https://rust-lang-nursery.github.io/rust-cookbook/algorithms/randomness.html
use rand::Rng;
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
(0..num_chars)
.map(|_| {
let i = rng.gen_range(0..alphabet.len());
let i = rng.random_range(0..alphabet.len());
alphabet[i] as char
})
.collect()