Update rand & rand_chacha to 0.9.0

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2025-01-30 07:47:39 +01:00
parent 22166e0e7c
commit a039cf2310
No known key found for this signature in database
4 changed files with 104 additions and 22 deletions

105
Cargo.lock generated
View file

@ -633,7 +633,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"wasi", "wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
dependencies = [
"cfg-if",
"libc",
"wasi 0.13.3+wasi-0.2.2",
"windows-targets",
] ]
[[package]] [[package]]
@ -871,8 +883,8 @@ dependencies = [
"figment", "figment",
"figment_file_provider_adapter", "figment_file_provider_adapter",
"handlebars", "handlebars",
"rand", "rand 0.9.0",
"rand_chacha", "rand_chacha 0.9.0",
"rust-embed", "rust-embed",
"serde", "serde",
"sha2", "sha2",
@ -976,7 +988,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [ dependencies = [
"libc", "libc",
"wasi", "wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@ -1157,7 +1169,7 @@ version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [ dependencies = [
"zerocopy", "zerocopy 0.7.35",
] ]
[[package]] [[package]]
@ -1230,8 +1242,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha 0.3.1",
"rand_core", "rand_core 0.6.4",
]
[[package]]
name = "rand"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.0",
"zerocopy 0.8.14",
] ]
[[package]] [[package]]
@ -1241,7 +1264,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core", "rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core 0.9.0",
] ]
[[package]] [[package]]
@ -1250,7 +1283,17 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [ dependencies = [
"getrandom", "getrandom 0.2.15",
]
[[package]]
name = "rand_core"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff"
dependencies = [
"getrandom 0.3.1",
"zerocopy 0.8.14",
] ]
[[package]] [[package]]
@ -1657,7 +1700,7 @@ dependencies = [
"indexmap 1.9.3", "indexmap 1.9.3",
"pin-project", "pin-project",
"pin-project-lite", "pin-project-lite",
"rand", "rand 0.8.5",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -1861,6 +1904,15 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi"
version = "0.13.3+wasi-0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
dependencies = [
"wit-bindgen-rt",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -1883,7 +1935,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -1983,6 +2035,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "wit-bindgen-rt"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "yansi" name = "yansi"
version = "1.0.1" version = "1.0.1"
@ -1996,7 +2057,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"zerocopy-derive", "zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468"
dependencies = [
"zerocopy-derive 0.8.14",
] ]
[[package]] [[package]]
@ -2009,3 +2079,14 @@ dependencies = [
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "zerocopy-derive"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

View file

@ -20,8 +20,8 @@
figment = { version = "0.10.19", features = ["toml", "env"] } figment = { version = "0.10.19", features = ["toml", "env"] }
figment_file_provider_adapter = "0.1.1" figment_file_provider_adapter = "0.1.1"
handlebars = { version = "6.3.0", features = ["dir_source", "rust-embed"] } handlebars = { version = "6.3.0", features = ["dir_source", "rust-embed"] }
rand = "0.8.5" rand = "0.9.0"
rand_chacha = "0.3.1" rand_chacha = "0.9.0"
rust-embed = "8.5.0" rust-embed = "8.5.0"
serde = { version = "1.0.217", features = ["derive"] } serde = { version = "1.0.217", features = ["derive"] }
sha2 = "0.10.8" sha2 = "0.10.8"

View file

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
use handlebars::Handlebars; use handlebars::Handlebars;
use rand::{seq::SliceRandom, Rng}; use rand::{seq::IndexedRandom, Rng};
use rust_embed::Embed; use rust_embed::Embed;
use serde::Serialize; use serde::Serialize;
@ -93,31 +93,32 @@ impl AssembledStatisticalSequences {
// markov // markov
let paragraph_count = rng.gen_range( let paragraph_count = rng.random_range(
iocaine.config.generator.markov.paragraphs.min iocaine.config.generator.markov.paragraphs.min
..=iocaine.config.generator.markov.paragraphs.max, ..=iocaine.config.generator.markov.paragraphs.max,
); );
let paragraphs: Vec<Enumerator<u32>> = (0..paragraph_count) let paragraphs: Vec<Enumerator<u32>> = (0..paragraph_count)
.map(|idx| Enumerator::<u32> { .map(|idx| Enumerator::<u32> {
index: idx, index: idx,
value: rng.gen_range( value: rng.random_range(
iocaine.config.generator.markov.words.min iocaine.config.generator.markov.words.min
..=iocaine.config.generator.markov.words.max, ..=iocaine.config.generator.markov.words.max,
), ),
}) })
.collect(); .collect();
let link_count = rng let link_count = rng.random_range(
.gen_range(iocaine.config.generator.links.min..=(iocaine.config.generator.links.max)); iocaine.config.generator.links.min..=(iocaine.config.generator.links.max),
);
let links: Vec<Enumerator<Link>> = (0..link_count) let links: Vec<Enumerator<Link>> = (0..link_count)
.map(|idx| Enumerator::<Link> { .map(|idx| Enumerator::<Link> {
index: idx, index: idx,
value: Link { value: Link {
href_words: rng.gen_range( href_words: rng.random_range(
iocaine.config.generator.links.href_words.min iocaine.config.generator.links.href_words.min
..=iocaine.config.generator.links.href_words.max, ..=iocaine.config.generator.links.href_words.max,
), ),
title_words: rng.gen_range( title_words: rng.random_range(
iocaine.config.generator.links.title_words.min iocaine.config.generator.links.title_words.min
..=iocaine.config.generator.links.title_words.max, ..=iocaine.config.generator.links.title_words.max,
), ),

View file

@ -7,7 +7,7 @@
// //
// Originally based on code borrowed from https://github.com/mgeisler/lipsum // Originally based on code borrowed from https://github.com/mgeisler/lipsum
use rand::{seq::SliceRandom, Rng}; use rand::{seq::IndexedRandom, Rng};
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::io; use std::io;