Skip to content

Commit 96f8df6

Browse files
authored
Prepare 0.9.0 release (#1558)
1 parent 34da321 commit 96f8df6

File tree

13 files changed

+128
-153
lines changed

13 files changed

+128
-153
lines changed

CHANGELOG.md

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,98 +8,107 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).
88

99
You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful.
1010

11-
## [0.9.0-beta.3] - 2025-01-03
12-
- Add feature `thread_rng` (#1547)
13-
- Move `distr::Slice` -> `distr::slice::Choose`, `distr::EmptySlice` -> `distr::slice::Empty` (#1548)
14-
- Rename trait `distr::DistString` -> `distr::SampleString` (#1548)
15-
- Rename `distr::DistIter` -> `distr::Iter`, `distr::DistMap` -> `distr::Map` (#1548)
16-
- Move `distr::{Weight, WeightError, WeightedIndex}` -> `distr::weighted::{Weight, Error, WeightedIndex}` (#1548)
17-
18-
## [0.9.0-beta.1] - 2024-11-30
19-
- Bump `rand_core` version
20-
21-
## [0.9.0-beta.0] - 2024-11-25
22-
This is a pre-release. To depend on this version, use `rand = "=0.9.0-beta.0"` to prevent automatic updates (which can be expected to include breaking changes).
23-
11+
## [0.9.0] - 2025-01-27
2412
### Security and unsafe
2513
- Policy: "rand is not a crypto library" (#1514)
2614
- Remove fork-protection from `ReseedingRng` and `ThreadRng`. Instead, it is recommended to call `ThreadRng::reseed` on fork. (#1379)
2715
- Use `zerocopy` to replace some `unsafe` code (#1349, #1393, #1446, #1502)
2816

29-
### Compilation options
17+
### Dependencies
3018
- Bump the MSRV to 1.63.0 (#1207, #1246, #1269, #1341, #1416, #1536); note that 1.60.0 may work for dependents when using `--ignore-rust-version`
19+
- Update to `rand_core` v0.9.0 (#1558)
20+
21+
### Features
3122
- Support `std` feature without `getrandom` or `rand_chacha` (#1354)
32-
- Improve `thread_rng` related docs (#1257)
33-
- The `serde1` feature has been renamed `serde` (#1477)
34-
- The implicit feature `rand_chacha` has been removed. This is enabled by `std_rng`. (#1473)
3523
- Enable feature `small_rng` by default (#1455)
24+
- Remove implicit feature `rand_chacha`; use `std_rng` instead. (#1473)
25+
- Rename feature `serde1` to `serde` (#1477)
3626
- Rename feature `getrandom` to `os_rng` (#1537)
27+
- Add feature `thread_rng` (#1547)
3728

38-
### Inherited changes from `rand_core`
29+
### API changes: rand_core traits
3930
- Add fn `RngCore::read_adapter` implementing `std::io::Read` (#1267)
4031
- Add trait `CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` (#1273)
4132
- Add traits `TryRngCore`, `TryCryptoRng` (#1424, #1499)
33+
- Rename `fn SeedableRng::from_rng` -> `try_from_rng` and add infallible variant `fn from_rng` (#1424)
34+
- Rename `fn SeedableRng::from_entropy` -> `from_os_rng` and add fallible variant `fn try_from_os_rng` (#1424)
4235
- Add bounds `Clone` and `AsRef` to associated type `SeedableRng::Seed` (#1491)
4336

44-
### Rng trait and top-level fns
45-
- Rename fn `rand::thread_rng()` to `rand::rng()`, and remove from the prelude (#1506)
46-
- Add top-level fns `random_iter`, `random_range`, `random_bool`, `random_ratio`, `fill` (#1488)
37+
### API changes: Rng trait and top-level fns
38+
- Rename fn `rand::thread_rng()` to `rand::rng()` and remove from the prelude (#1506)
4739
- Remove fn `rand::random()` from the prelude (#1506)
40+
- Add top-level fns `random_iter`, `random_range`, `random_bool`, `random_ratio`, `fill` (#1488)
4841
- Re-introduce fn `Rng::gen_iter` as `random_iter` (#1305, #1500)
4942
- Rename fn `Rng::gen` to `random` to avoid conflict with the new `gen` keyword in Rust 2024 (#1438)
5043
- Rename fns `Rng::gen_range` to `random_range`, `gen_bool` to `random_bool`, `gen_ratio` to `random_ratio` (#1505)
5144
- Annotate panicking methods with `#[track_caller]` (#1442, #1447)
5245

53-
### RNGs
54-
- Make `ReseedingRng::reseed` discard remaining data from the last block generated (#1379)
55-
- Change fn `SmallRng::seed_from_u64` implementation (#1203)
46+
### API changes: RNGs
5647
- Fix `<SmallRng as SeedableRng>::Seed` size to 256 bits (#1455)
5748
- Remove first parameter (`rng`) of `ReseedingRng::new` (#1533)
58-
- Improve SmallRng initialization performance (#1482)
5949

60-
### Sequences
61-
- Optimize fn `sample_floyd`, affecting output of `rand::seq::index::sample` and `rand::seq::SliceRandom::choose_multiple` (#1277)
62-
- New, faster algorithms for `IteratorRandom::choose` and `choose_stable` (#1268)
63-
- New, faster algorithms for `SliceRandom::shuffle` and `partial_shuffle` (#1272)
50+
### API changes: Sequences
6451
- Split trait `SliceRandom` into `IndexedRandom`, `IndexedMutRandom`, `SliceRandom` (#1382)
6552
- Add `IndexedRandom::choose_multiple_array`, `index::sample_array` (#1453, #1469)
66-
- Fix `IndexdRandom::choose_multiple_weighted` for very small seeds and optimize for large input length / low memory (#1530)
6753

68-
### Distributions
54+
### API changes: Distributions: renames
6955
- Rename module `rand::distributions` to `rand::distr` (#1470)
70-
- Relax `Sized` bound on `Distribution<T> for &D` (#1278)
7156
- Rename distribution `Standard` to `StandardUniform` (#1526)
57+
- Move `distr::Slice` -> `distr::slice::Choose`, `distr::EmptySlice` -> `distr::slice::Empty` (#1548)
58+
- Rename trait `distr::DistString` -> `distr::SampleString` (#1548)
59+
- Rename `distr::DistIter` -> `distr::Iter`, `distr::DistMap` -> `distr::Map` (#1548)
60+
61+
### API changes: Distributions
62+
- Relax `Sized` bound on `Distribution<T> for &D` (#1278)
7263
- Remove impl of `Distribution<Option<T>>` for `StandardUniform` (#1526)
7364
- Let distribution `StandardUniform` support all `NonZero*` types (#1332)
7465
- Fns `{Uniform, UniformSampler}::{new, new_inclusive}` return a `Result` (instead of potentially panicking) (#1229)
7566
- Distribution `Uniform` implements `TryFrom` instead of `From` for ranges (#1229)
76-
- Optimize distribution `Uniform`: use Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287)
77-
- Add `UniformUsize` and use to make `Uniform` for `usize` portable (#1487)
78-
- Remove support for generating `isize` and `usize` values with `Standard`, `Uniform` (except via `UniformUsize`) and `Fill` and usage as a `WeightedAliasIndex` weight (#1487)
79-
- Optimize fn `sample_single_inclusive` for floats (+~20% perf) (#1289)
80-
- Allow `UniformFloat::new` samples and `UniformFloat::sample_single` to yield `high` (#1462)
67+
- Add `UniformUsize` (#1487)
68+
- Remove support for generating `isize` and `usize` values with `StandardUniform`, `Uniform` (except via `UniformUsize`) and `Fill` and usage as a `WeightedAliasIndex` weight (#1487)
8169
- Add impl `DistString` for distributions `Slice<char>` and `Uniform<char>` (#1315)
8270
- Add fn `Slice::num_choices` (#1402)
83-
- Fix portability of distribution `Slice` (#1469)
84-
- Add trait `Weight`, allowing `WeightedIndex` to trap overflow (#1353)
85-
- Add fns `weight, weights, total_weight` to distribution `WeightedIndex` (#1420)
86-
- Rename enum `WeightedError` to `WeightError`, revising variants (#1382) and mark as `#[non_exhaustive]` (#1480)
8771
- Add fn `p()` for distribution `Bernoulli` to access probability (#1481)
8872

89-
### SIMD
73+
### API changes: Weighted distributions
74+
- Add `pub` module `rand::distr::weighted`, moving `WeightedIndex` there (#1548)
75+
- Add trait `weighted::Weight`, allowing `WeightedIndex` to trap overflow (#1353)
76+
- Add fns `weight, weights, total_weight` to distribution `WeightedIndex` (#1420)
77+
- Rename enum `WeightedError` to `weighted::Error`, revising variants (#1382) and mark as `#[non_exhaustive]` (#1480)
78+
79+
### API changes: SIMD
9080
- Switch to `std::simd`, expand SIMD & docs (#1239)
91-
- Optimise SIMD widening multiply (#1247)
9281

93-
### Documentation
94-
- Add `Cargo.lock.msrv` file (#1275)
95-
- Docs: enable experimental `--generate-link-to-definition` feature (#1327)
96-
- Better doc of crate features, use `doc_auto_cfg` (#1411, #1450)
82+
### Reproducibility-breaking changes
83+
- Make `ReseedingRng::reseed` discard remaining data from the last block generated (#1379)
84+
- Change fn `SmallRng::seed_from_u64` implementation (#1203)
85+
- Allow `UniformFloat::new` samples and `UniformFloat::sample_single` to yield `high` (#1462)
86+
- Fix portability of distribution `Slice` (#1469)
87+
- Make `Uniform` for `usize` portable via `UniformUsize` (#1487)
88+
- Fix `IndexdRandom::choose_multiple_weighted` for very small seeds and optimize for large input length / low memory (#1530)
89+
90+
### Reproducibility-breaking optimisations
91+
- Optimize fn `sample_floyd`, affecting output of `rand::seq::index::sample` and `rand::seq::SliceRandom::choose_multiple` (#1277)
92+
- New, faster algorithms for `IteratorRandom::choose` and `choose_stable` (#1268)
93+
- New, faster algorithms for `SliceRandom::shuffle` and `partial_shuffle` (#1272)
94+
- Optimize distribution `Uniform`: use Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287)
95+
- Optimize fn `sample_single_inclusive` for floats (+~20% perf) (#1289)
96+
97+
### Other optimisations
98+
- Improve `SmallRng` initialization performance (#1482)
99+
- Optimise SIMD widening multiply (#1247)
97100

98101
### Other
102+
- Add `Cargo.lock.msrv` file (#1275)
99103
- Reformat with `rustfmt` and enforce (#1448)
100104
- Apply Clippy suggestions and enforce (#1448, #1474)
101105
- Move all benchmarks to new `benches` crate (#1329, #1439) and migrate to Criterion (#1490)
102106

107+
### Documentation
108+
- Improve `ThreadRng` related docs (#1257)
109+
- Docs: enable experimental `--generate-link-to-definition` feature (#1327)
110+
- Better doc of crate features, use `doc_auto_cfg` (#1411, #1450)
111+
103112
## [0.8.5] - 2021-08-20
104113
### Fixes
105114
- Fix build on non-32/64-bit architectures (#1144)

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand"
3-
version = "0.9.0-beta.3"
3+
version = "0.9.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -72,14 +72,14 @@ members = [
7272
exclude = ["benches", "distr_test"]
7373

7474
[dependencies]
75-
rand_core = { path = "rand_core", version = "=0.9.0-beta.1", default-features = false }
75+
rand_core = { path = "rand_core", version = "0.9.0", default-features = false }
7676
log = { version = "0.4.4", optional = true }
7777
serde = { version = "1.0.103", features = ["derive"], optional = true }
78-
rand_chacha = { path = "rand_chacha", version = "=0.9.0-beta.1", default-features = false, optional = true }
78+
rand_chacha = { path = "rand_chacha", version = "0.9.0", default-features = false, optional = true }
7979
zerocopy = { version = "0.8.0", default-features = false, features = ["simd"] }
8080

8181
[dev-dependencies]
82-
rand_pcg = { path = "rand_pcg", version = "=0.9.0-beta.1" }
82+
rand_pcg = { path = "rand_pcg", version = "0.9.0" }
8383
# Only to test serde
8484
bincode = "1.2.1"
8585
rayon = "1.7"

README.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ All with:
3333

3434
Rand **is not**:
3535

36-
- Small (LOC). Most low-level crates are small, but the higher-level `rand`
36+
- Small (LoC). Most low-level crates are small, but the higher-level `rand`
3737
and `rand_distr` each contain a lot of functionality.
3838
- Simple (implementation). We have a strong focus on correctness, speed and flexibility, but
3939
not simplicity. If you prefer a small-and-simple library, there are
@@ -53,29 +53,12 @@ Documentation:
5353
- [API reference (docs.rs)](https://docs.rs/rand)
5454

5555

56-
## Usage
57-
58-
Add this to your `Cargo.toml`:
59-
```toml
60-
[dependencies]
61-
rand = "0.8.5"
62-
```
63-
64-
Or, to try the 0.9.0 beta release:
65-
```toml
66-
[dependencies]
67-
rand = "=0.9.0-beta.3"
68-
```
69-
70-
To get started using Rand, see [The Book](https://rust-random.github.io/book).
71-
7256
## Versions
7357

7458
Rand is *mature* (suitable for general usage, with infrequent breaking releases
7559
which minimise breakage) but not yet at 1.0. Current versions are:
7660

77-
- Version 0.8 was released in December 2020 with many small changes.
78-
- Version 0.9 is in development with many small changes.
61+
- Version 0.9 was released in January 2025.
7962

8063
See the [CHANGELOG](CHANGELOG.md) or [Upgrade Guide](https://rust-random.github.io/book/update.html) for more details.
8164

distr_test/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ edition = "2021"
55
publish = false
66

77
[dev-dependencies]
8-
rand_distr = { path = "../rand_distr", version = "=0.5.0-beta.3", default-features = false, features = ["alloc"] }
9-
rand = { path = "..", version = "=0.9.0-beta.3", features = ["small_rng"] }
8+
rand_distr = { path = "../rand_distr", version = "0.5.0", default-features = false, features = ["alloc"] }
9+
rand = { path = "..", version = "0.9.0", features = ["small_rng"] }
1010
num-traits = "0.2.19"
1111
# Special functions for testing distributions
1212
special = "0.11.0"

rand_chacha/CHANGELOG.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ 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.9.0-beta.1] - 2024-11-30
8-
- Bump `rand_core` version
9-
10-
## [0.9.0-beta.0] - 2024-11-25
11-
This is a pre-release. To depend on this version, use `rand_chacha = "=0.9.0-beta.0"` to prevent automatic updates (which can be expected to include breaking changes).
7+
## [0.9.0] - 2025-01-27
8+
### Dependencies and features
9+
- Update to `rand_core` v0.9.0 (#1558)
10+
- Feature `std` now implies feature `rand_core/std` (#1153)
11+
- Rename feature `serde1` to `serde` (#1477)
12+
- Rename feature `getrandom` to `os_rng` (#1537)
1213

13-
- Made `rand_chacha` propagate the `std` feature down to `rand_core` (#1153)
14+
### Other changes
1415
- Remove usage of `unsafe` in `fn generate` (#1181) then optimise for AVX2 (~4-7%) (#1192)
15-
- The `serde1` feature has been renamed `serde` (#1477)
1616
- Revise crate docs (#1454)
17-
- Rename feature `getrandom` to `os_rng` (#1537)
1817

1918
## [0.3.1] - 2021-06-09
2019
- add getters corresponding to existing setters: `get_seed`, `get_stream` (#1124)

rand_chacha/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_chacha"
3-
version = "0.9.0-beta.1"
3+
version = "0.9.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers", "The CryptoCorrosion Contributors"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -20,14 +20,14 @@ all-features = true
2020
rustdoc-args = ["--generate-link-to-definition"]
2121

2222
[dependencies]
23-
rand_core = { path = "../rand_core", version = "=0.9.0-beta.1" }
23+
rand_core = { path = "../rand_core", version = "0.9.0" }
2424
ppv-lite86 = { version = "0.2.14", default-features = false, features = ["simd"] }
2525
serde = { version = "1.0", features = ["derive"], optional = true }
2626

2727
[dev-dependencies]
2828
# Only to test serde
2929
serde_json = "1.0"
30-
rand_core = { path = "../rand_core", version = "=0.9.0-beta.1", features = ["os_rng"] }
30+
rand_core = { path = "../rand_core", version = "0.9.0", features = ["os_rng"] }
3131

3232
[features]
3333
default = ["std"]

rand_core/CHANGELOG.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ 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.9.0-beta.1] - 2024-11-30
8-
- Update to `getrandom` v0.3.0-rc.0
9-
10-
## [0.9.0-beta.0] - 2024-11-25
11-
This is a pre-release. To depend on this version, use `rand_core = "=0.9.0-beta.0"` to prevent automatic updates (which can be expected to include breaking changes).
12-
13-
### Compilation options and unsafe
7+
## [0.9.0] - 2025-01-27
8+
### Dependencies and features
149
- Bump the MSRV to 1.63.0 (#1207, #1246, #1269, #1341, #1416, #1536); note that 1.60.0 may work for dependents when using `--ignore-rust-version`
15-
- The `serde1` feature has been renamed `serde` (#1477)
10+
- Update to `getrandom` v0.3.0 (#1558)
1611
- Use `zerocopy` to replace some `unsafe` code (#1349, #1393, #1446, #1502)
12+
- Rename feature `serde1` to `serde` (#1477)
13+
- Rename feature `getrandom` to `os_rng` (#1537)
1714

18-
### Other
15+
### API changes
1916
- Allow `rand_core::impls::fill_via_u*_chunks` to mutate source (#1182)
2017
- Add fn `RngCore::read_adapter` implementing `std::io::Read` (#1267)
2118
- Add trait `CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` (#1273)
2219
- Add traits `TryRngCore`, `TryCryptoRng` (#1424, #1499)
20+
- Rename `fn SeedableRng::from_rng` -> `try_from_rng` and add infallible variant `fn from_rng` (#1424)
21+
- Rename `fn SeedableRng::from_entropy` -> `from_os_rng` and add fallible variant `fn try_from_os_rng` (#1424)
2322
- Add bounds `Clone` and `AsRef` to associated type `SeedableRng::Seed` (#1491)
24-
- Rename feature `getrandom` to `os_rng` (#1537)
2523

2624
## [0.6.4] - 2022-09-15
2725
- Fix unsoundness in `<BlockRng64 as RngCore>::next_u32` (#1160)

rand_core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_core"
3-
version = "0.9.0-beta.1"
3+
version = "0.9.0"
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -31,5 +31,5 @@ serde = ["dep:serde"] # enables serde for BlockRng wrapper
3131

3232
[dependencies]
3333
serde = { version = "1", features = ["derive"], optional = true }
34-
getrandom = { version = "0.3.0-rc.0", optional = true }
34+
getrandom = { version = "0.3.0", optional = true }
3535
zerocopy = { version = "0.8.0", default-features = false }

rand_core/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,18 @@ pub trait CryptoRng: RngCore {}
205205

206206
impl<T: DerefMut> CryptoRng for T where T::Target: CryptoRng {}
207207

208-
/// A potentially fallible version of [`RngCore`].
208+
/// A potentially fallible variant of [`RngCore`]
209209
///
210-
/// This trait is primarily used for IO-based generators such as [`OsRng`].
210+
/// This trait is a generalization of [`RngCore`] to support potentially-
211+
/// fallible IO-based generators such as [`OsRng`].
211212
///
212-
/// Most of higher-level generic code in the `rand` crate is built on top
213-
/// of the the [`RngCore`] trait. Users can transform a fallible RNG
214-
/// (i.e. [`TryRngCore`] implementor) into an "infallible" (but potentially
215-
/// panicking) RNG (i.e. [`RngCore`] implementor) using the [`UnwrapErr`] wrapper.
213+
/// All implementations of [`RngCore`] automatically support this `TryRngCore`
214+
/// trait, using [`Infallible`][core::convert::Infallible] as the associated
215+
/// `Error` type.
216216
///
217-
/// [`RngCore`] implementors also usually implement [`TryRngCore`] with the `Error`
218-
/// associated type being equal to [`Infallible`][core::convert::Infallible].
219-
/// In other words, users can use [`TryRngCore`] to generalize over fallible and
220-
/// infallible RNGs.
217+
/// An implementation of this trait may be made compatible with code requiring
218+
/// an [`RngCore`] through [`TryRngCore::unwrap_err`]. The resulting RNG will
219+
/// panic in case the underlying fallible RNG yields an error.
221220
pub trait TryRngCore {
222221
/// The type returned in the event of a RNG error.
223222
type Error: fmt::Debug + fmt::Display;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy