Skip to content

Commit 242e4bd

Browse files
authored
Use rand 0.9.0; fixes (#58)
1 parent 3508878 commit 242e4bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+123
-179
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- os: ubuntu-latest
4848
target: x86_64-unknown-linux-gnu
4949
variant: MSRV
50-
toolchain: 1.61.0
50+
toolchain: 1.63.0
5151
- os: ubuntu-latest
5252
deps: sudo apt-get update ; sudo apt install gcc-multilib
5353
target: i686-unknown-linux-gnu

.github/workflows/workspace.yml

+5-14
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,21 @@ on:
44
pull_request:
55
paths-ignore:
66
- README.md
7-
- "benches/**"
87
push:
98
branches: master
109
paths-ignore:
1110
- README.md
12-
- "benches/**"
1311

1412
jobs:
1513
clippy:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v4
19-
- uses: dtolnay/rust-toolchain@master
20-
with:
21-
toolchain: 1.78.0
22-
components: clippy
23-
- run: cargo clippy --all --all-targets -- -D warnings
24-
25-
rustfmt:
2614
runs-on: ubuntu-latest
2715
steps:
2816
- uses: actions/checkout@v4
2917
- uses: dtolnay/rust-toolchain@master
3018
with:
3119
toolchain: stable
32-
components: rustfmt
33-
- run: cargo fmt --all -- --check
20+
components: clippy, rustfmt
21+
- name: Clippy
22+
run: cargo clippy --all --all-targets -- -D warnings
23+
- name: Rustfmt
24+
run: cargo fmt --all -- --check

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ exclude = [
1010
"benches",
1111
]
1212
resolver = "2"
13-
14-
[patch.crates-io.rand_core]
15-
git = "https://github.com/rust-random/rand.git"
16-
branch = "master"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Test Status](https://github.com/rust-random/rngs/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rngs/actions)
44
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
55
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand)
6-
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.61-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements)
6+
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.63-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements)
77

88
Extra random number generators provided by the Rust Random project.
99
The main repository, [rust-random/rand](https://github.com/rust-random/rand),

benches/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
name = "benches"
33
version = "0.1.0"
44
edition = "2021"
5-
rust-version = "1.61"
5+
rust-version = "1.63"
66
publish = false
77

88
[dev-dependencies]
99
criterion = "0.5.0"
1010
criterion-cycles-per-byte = "0.6"
11-
rand_core = { version = "=0.9.0-alpha.1", features = ["getrandom"] }
12-
rand_xoshiro = { path = "../rand_xoshiro", version = "0.6" }
13-
rand_isaac = { path = "../rand_isaac", version = "0.3" }
14-
rand_xorshift = { path = "../rand_xorshift", version = "0.3" }
15-
rand_hc = { path = "../rand_hc", version = "0.3" }
11+
rand_core = { version = "0.9.0", features = ["os_rng"] }
12+
rand_xoshiro = { path = "../rand_xoshiro", version = "0.7" }
13+
rand_isaac = { path = "../rand_isaac", version = "0.4" }
14+
rand_xorshift = { path = "../rand_xorshift", version = "0.4" }
15+
rand_hc = { path = "../rand_hc", version = "0.4" }
1616

1717
[[bench]]
1818
name = "mod"

rand_hc/CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.3.3] - unreleased
7+
## [0.4.0] - 2025-01-27
8+
- Bump the MSRV to 1.63 (#58)
9+
- Update to `rand_core` v0.9.0 (#58)
810
- Add examples for initializing the RNGs
911

1012
## [0.3.2] - 2023-04-15

rand_hc/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_hc"
3-
version = "0.3.2"
3+
version = "0.4.0"
44
authors = ["The Rand Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -13,7 +13,7 @@ HC128 random number generator
1313
keywords = ["random", "rng", "hc128"]
1414
categories = ["algorithms", "no-std"]
1515
edition = "2021"
16-
rust-version = "1.61"
16+
rust-version = "1.63"
1717

1818
[dependencies]
19-
rand_core = "=0.9.0-alpha.1"
19+
rand_core = "0.9.0"

rand_hc/src/hc128.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ impl RngCore for Hc128Rng {
8989
}
9090
}
9191

92-
rand_core::impl_try_crypto_rng_from_crypto_rng!(Hc128Rng);
93-
9492
impl SeedableRng for Hc128Rng {
9593
type Seed = <Hc128Core as SeedableRng>::Seed;
9694

@@ -100,12 +98,12 @@ impl SeedableRng for Hc128Rng {
10098
}
10199

102100
#[inline]
103-
fn from_rng(rng: impl RngCore) -> Self {
101+
fn from_rng(rng: &mut impl RngCore) -> Self {
104102
Hc128Rng(BlockRng::<Hc128Core>::from_rng(rng))
105103
}
106104

107105
#[inline]
108-
fn try_from_rng<R: TryRngCore>(rng: R) -> Result<Self, R::Error> {
106+
fn try_from_rng<R: TryRngCore>(rng: &mut R) -> Result<Self, R::Error> {
109107
BlockRng::<Hc128Core>::try_from_rng(rng).map(Hc128Rng)
110108
}
111109
}

rand_isaac/CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.3.1] - unreleased
8-
- Correctly document MSRV as 1.36
7+
## [0.4.0] - 2025-01-27
8+
- Bump the MSRV to 1.63 (#58)
9+
- Update to `rand_core` v0.9.0 (#58)
10+
- Rename feature `serde1` to `serde` (#58)
911
- Fix compiler and clippy warnings
1012
- Add examples for initializing the RNGs
1113

rand_isaac/Cargo.toml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_isaac"
3-
version = "0.3.0" # NB: When modifying, also modify html_root_url in lib.rs
3+
version = "0.4.0" # NB: When modifying, also modify html_root_url in lib.rs
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -13,16 +13,14 @@ ISAAC random number generator
1313
keywords = ["random", "rng", "isaac"]
1414
categories = ["algorithms", "no-std"]
1515
edition = "2021"
16-
rust-version = "1.61"
16+
rust-version = "1.63"
1717

1818
[features]
19-
serde1 = ["serde", "rand_core/serde1"]
19+
serde = ["dep:serde", "rand_core/serde"]
2020

2121
[dependencies]
22-
rand_core = { version = "=0.9.0-alpha.1" }
23-
serde = { version = "1.0.103", features = ["derive"], optional = true }
24-
# Not a direct dependency but required to boost the minimum version:
25-
serde_derive = { version = "1.0.103", optional = true }
22+
rand_core = { version = "0.9.0" }
23+
serde = { version = "1.0.104", features = ["derive"], optional = true }
2624

2725
[dev-dependencies]
2826
# This is for testing serde, unfortunately we can't specify feature-gated dev

rand_isaac/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Links:
3232
`rand_isaac` is `no_std` compatible. It does not require any functionality
3333
outside of the `core` lib, thus there are no features to configure.
3434

35-
The `serde1` feature includes implementations of `Serialize` and `Deserialize`
35+
The `serde` feature includes implementations of `Serialize` and `Deserialize`
3636
for the included RNGs.
3737

3838

rand_isaac/src/isaac.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use core::num::Wrapping as w;
1414
use core::{fmt, slice};
1515
use rand_core::block::{BlockRng, BlockRngCore};
1616
use rand_core::{le, RngCore, SeedableRng, TryRngCore};
17-
#[cfg(feature = "serde1")]
17+
#[cfg(feature = "serde")]
1818
use serde::{Deserialize, Serialize};
1919

2020
#[allow(non_camel_case_types)]
@@ -90,7 +90,7 @@ const RAND_SIZE: usize = 1 << RAND_SIZE_LEN;
9090
///
9191
/// [`rand_hc`]: https://docs.rs/rand_hc
9292
#[derive(Debug, Clone)]
93-
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
93+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
9494
pub struct IsaacRng(BlockRng<IsaacCore>);
9595

9696
impl RngCore for IsaacRng {
@@ -110,8 +110,6 @@ impl RngCore for IsaacRng {
110110
}
111111
}
112112

113-
rand_core::impl_try_rng_from_rng_core!(IsaacRng);
114-
115113
impl SeedableRng for IsaacRng {
116114
type Seed = <IsaacCore as SeedableRng>::Seed;
117115

@@ -129,22 +127,22 @@ impl SeedableRng for IsaacRng {
129127
}
130128

131129
#[inline]
132-
fn from_rng(rng: impl RngCore) -> Self {
130+
fn from_rng(rng: &mut impl RngCore) -> Self {
133131
IsaacRng(BlockRng::<IsaacCore>::from_rng(rng))
134132
}
135133

136134
#[inline]
137-
fn try_from_rng<S: TryRngCore>(rng: S) -> Result<Self, S::Error> {
135+
fn try_from_rng<S: TryRngCore>(rng: &mut S) -> Result<Self, S::Error> {
138136
BlockRng::<IsaacCore>::try_from_rng(rng).map(IsaacRng)
139137
}
140138
}
141139

142140
/// The core of [`IsaacRng`], used with [`BlockRng`].
143141
#[derive(Clone)]
144-
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
142+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
145143
pub struct IsaacCore {
146144
#[cfg_attr(
147-
feature = "serde1",
145+
feature = "serde",
148146
serde(with = "super::isaac_array::isaac_array_serde")
149147
)]
150148
mem: [w32; RAND_SIZE],
@@ -367,7 +365,7 @@ impl SeedableRng for IsaacCore {
367365
Self::init(key, 1)
368366
}
369367

370-
fn from_rng(mut rng: impl RngCore) -> Self {
368+
fn from_rng(rng: &mut impl RngCore) -> Self {
371369
// Custom `from_rng` implementation that fills a seed with the same size
372370
// as the entire state.
373371
let mut seed = [w(0u32); RAND_SIZE];
@@ -384,7 +382,7 @@ impl SeedableRng for IsaacCore {
384382
Self::init(seed, 2)
385383
}
386384

387-
fn try_from_rng<R: TryRngCore>(mut rng: R) -> Result<Self, R::Error> {
385+
fn try_from_rng<R: TryRngCore>(rng: &mut R) -> Result<Self, R::Error> {
388386
// Custom `from_rng` implementation that fills a seed with the same size
389387
// as the entire state.
390388
let mut seed = [w(0u32); RAND_SIZE];
@@ -417,7 +415,7 @@ mod test {
417415
let mut rng1 = IsaacRng::from_seed(seed);
418416
assert_eq!(rng1.next_u32(), 2869442790);
419417

420-
let mut rng2 = IsaacRng::from_rng(rng1);
418+
let mut rng2 = IsaacRng::from_rng(&mut rng1);
421419
assert_eq!(rng2.next_u32(), 3094074039);
422420
}
423421

@@ -533,7 +531,7 @@ mod test {
533531
}
534532

535533
#[test]
536-
#[cfg(feature = "serde1")]
534+
#[cfg(feature = "serde")]
537535
fn test_isaac_serde() {
538536
use bincode;
539537
use std::io::{BufReader, BufWriter};

rand_isaac/src/isaac64.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use core::num::Wrapping as w;
1414
use core::{fmt, slice};
1515
use rand_core::block::{BlockRng64, BlockRngCore};
1616
use rand_core::{le, RngCore, SeedableRng, TryRngCore};
17-
#[cfg(feature = "serde1")]
17+
#[cfg(feature = "serde")]
1818
use serde::{Deserialize, Serialize};
1919

2020
#[allow(non_camel_case_types)]
@@ -81,7 +81,7 @@ const RAND_SIZE: usize = 1 << RAND_SIZE_LEN;
8181
/// [`rand_hc`]: https://docs.rs/rand_hc
8282
/// [`BlockRng64`]: rand_core::block::BlockRng64
8383
#[derive(Debug, Clone)]
84-
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
84+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8585
pub struct Isaac64Rng(BlockRng64<Isaac64Core>);
8686

8787
impl RngCore for Isaac64Rng {
@@ -101,8 +101,6 @@ impl RngCore for Isaac64Rng {
101101
}
102102
}
103103

104-
rand_core::impl_try_rng_from_rng_core!(Isaac64Rng);
105-
106104
impl SeedableRng for Isaac64Rng {
107105
type Seed = <Isaac64Core as SeedableRng>::Seed;
108106

@@ -120,22 +118,22 @@ impl SeedableRng for Isaac64Rng {
120118
}
121119

122120
#[inline]
123-
fn from_rng(rng: impl RngCore) -> Self {
121+
fn from_rng(rng: &mut impl RngCore) -> Self {
124122
Isaac64Rng(BlockRng64::<Isaac64Core>::from_rng(rng))
125123
}
126124

127125
#[inline]
128-
fn try_from_rng<S: TryRngCore>(rng: S) -> Result<Self, S::Error> {
126+
fn try_from_rng<S: TryRngCore>(rng: &mut S) -> Result<Self, S::Error> {
129127
BlockRng64::<Isaac64Core>::try_from_rng(rng).map(Isaac64Rng)
130128
}
131129
}
132130

133131
/// The core of `Isaac64Rng`, used with `BlockRng`.
134132
#[derive(Clone)]
135-
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
133+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
136134
pub struct Isaac64Core {
137135
#[cfg_attr(
138-
feature = "serde1",
136+
feature = "serde",
139137
serde(with = "super::isaac_array::isaac_array_serde")
140138
)]
141139
mem: [w64; RAND_SIZE],
@@ -329,7 +327,7 @@ impl SeedableRng for Isaac64Core {
329327
Self::init(key, 1)
330328
}
331329

332-
fn from_rng(mut rng: impl RngCore) -> Self {
330+
fn from_rng(rng: &mut impl RngCore) -> Self {
333331
// Custom `from_rng` implementation that fills a seed with the same size
334332
// as the entire state.
335333
let mut seed = [w(0u64); RAND_SIZE];
@@ -345,7 +343,7 @@ impl SeedableRng for Isaac64Core {
345343
Self::init(seed, 2)
346344
}
347345

348-
fn try_from_rng<R: TryRngCore>(mut rng: R) -> Result<Self, R::Error> {
346+
fn try_from_rng<R: TryRngCore>(rng: &mut R) -> Result<Self, R::Error> {
349347
// Custom `from_rng` implementation that fills a seed with the same size
350348
// as the entire state.
351349
let mut seed = [w(0u64); RAND_SIZE];
@@ -377,7 +375,7 @@ mod test {
377375
let mut rng1 = Isaac64Rng::from_seed(seed);
378376
assert_eq!(rng1.next_u64(), 14964555543728284049);
379377

380-
let mut rng2 = Isaac64Rng::from_rng(rng1);
378+
let mut rng2 = Isaac64Rng::from_rng(&mut rng1);
381379
assert_eq!(rng2.next_u64(), 919595328260451758);
382380
}
383381

@@ -538,7 +536,7 @@ mod test {
538536
}
539537

540538
#[test]
541-
#[cfg(feature = "serde1")]
539+
#[cfg(feature = "serde")]
542540
fn test_isaac64_serde() {
543541
use bincode;
544542
use std::io::{BufReader, BufWriter};

rand_isaac/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![doc(
1414
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
1515
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
16-
html_root_url = "https://docs.rs/rand_isaac/0.3.0"
16+
html_root_url = "https://docs.rs/rand_isaac/0.4.0"
1717
)]
1818
#![deny(missing_docs)]
1919
#![deny(missing_debug_implementations)]

rand_jitter/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.4.0] - 2023-11-20
7+
## [0.5.0] - 2025-01-27
8+
- Bump the MSRV to 1.63 (#58)
9+
- Update to `rand_core` v0.9.0 (#58)
10+
11+
## [0.4.0] - 2023-12-08
812
### Changed
913
- Update to `rand_core` v0.6
1014
- Bump MSRV to 1.51

0 commit comments

Comments
 (0)