diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e53dc3ba2..974ff20551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,79 +8,86 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. -## [Unreleased] -- Add `rand::distributions::WeightedIndex::{weight, weights, total_weight}` (#1420) -- Add `IndexedRandom::choose_multiple_array`, `index::sample_array` (#1453, #1469) -- Bump the MSRV to 1.63.0 -- Rename `Rng::gen` to `Rng::random` to avoid conflict with the new `gen` keyword in Rust 2024 (#1435) -- Move all benchmarks to new `benches` crate (#1439) and migrate to Criterion (#1490) -- Annotate panicking methods with `#[track_caller]` (#1442, #1447) -- Enable feature `small_rng` by default (#1455) -- Allow `UniformFloat::new` samples and `UniformFloat::sample_single` to yield `high` (#1462) -- Fix portability of `rand::distributions::Slice` (#1469) -- Rename `rand::distributions` to `rand::distr` (#1470) -- The `serde1` feature has been renamed `serde` (#1477) -- The implicit feature `rand_chacha` has been removed. This is enabled by `std_rng`. (#1473) -- Mark `WeightError` as `#[non_exhaustive]` (#1480). -- Add `p()` for `Bernoulli` to access probability (#1481) -- Add `UniformUsize` and use to make `Uniform` for `usize` portable (#1487) -- Require `Clone` and `AsRef` bound for `SeedableRng::Seed`. (#1491) -- Improve SmallRng initialization performance (#1482) -- Rename `Rng::gen_iter` to `random_iter` (#1500) -- Rename `rand::thread_rng()` to `rand::rng()`, and remove from the prelude (#1506) -- Remove `rand::random()` from the prelude (#1506) -- Rename `Rng::gen_range` to `random_range`, `gen_bool` to `random_bool`, `gen_ratio` to `random_ratio` (#1505) -- Rename `Standard` to `StandardUniform` (#1526) -- Remove impl of `Distribution>` for `Standard` (#1526) -- Remove `SmallRng::from_thread_rng` (#1532) -- Remove first parameter (`rng`) of `ReseedingRng::new` (#1533) -- Rename feature `getrandom` to `os_rng` +## [0.9.0-beta.0] - 2024-11-25 +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). -## [0.9.0-alpha.1] - 2024-03-18 -- Add the `Slice::num_choices` method to the Slice distribution (#1402) +### Security and unsafe +- Policy: "rand is not a crypto library" (#1514) +- Remove fork-protection from `ReseedingRng` and `ThreadRng`. Instead, it is recommended to call `ThreadRng::reseed` on fork. (#1379) +- Use `zerocopy` to replace some `unsafe` code (#1349, #1393, #1446, #1502) -### Generators -- `ReseedingRng::reseed` also resets the random data cache. -- Remove fork-protection from `ReseedingRng` and `ThreadRng`. Instead, it is recommended to call `ThreadRng::reseed` on fork. - -## [0.9.0-alpha.0] - 2024-02-18 -This is a pre-release. To depend on this version, use `rand = "=0.9.0-alpha.0"` to prevent automatic updates (which can be expected to include breaking changes). +### Compilation options +- 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` +- Support `std` feature without `getrandom` or `rand_chacha` (#1354) +- Improve `thread_rng` related docs (#1257) +- The `serde1` feature has been renamed `serde` (#1477) +- The implicit feature `rand_chacha` has been removed. This is enabled by `std_rng`. (#1473) +- Enable feature `small_rng` by default (#1455) +- Rename feature `getrandom` to `os_rng` (#1537) + +### Inherited changes from `rand_core` +- Add fn `RngCore::read_adapter` implementing `std::io::Read` (#1267) +- Add trait `CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` (#1273) +- Add traits `TryRngCore`, `TryCryptoRng` (#1424, #1499) +- Add bounds `Clone` and `AsRef` to associated type `SeedableRng::Seed` (#1491) + +### Rng trait and top-level fns +- Rename fn `rand::thread_rng()` to `rand::rng()`, and remove from the prelude (#1506) +- Add top-level fns `random_iter`, `random_range`, `random_bool`, `random_ratio`, `fill` (#1488) +- Remove fn `rand::random()` from the prelude (#1506) +- Re-introduce fn `Rng::gen_iter` as `random_iter` (#1305, #1500) +- Rename fn `Rng::gen` to `random` to avoid conflict with the new `gen` keyword in Rust 2024 (#1438) +- Rename fns `Rng::gen_range` to `random_range`, `gen_bool` to `random_bool`, `gen_ratio` to `random_ratio` (#1505) +- Annotate panicking methods with `#[track_caller]` (#1442, #1447) -### Generators -- Change `SmallRng::seed_from_u64` implementation (#1203) -- Replace `SeedableRng` impl for `SmallRng` with inherent methods, excluding `fn from_seed` (#1368) +### RNGs +- Make `ReseedingRng::reseed` discard remaining data from the last block generated (#1379) +- Change fn `SmallRng::seed_from_u64` implementation (#1203) +- Fix `::Seed` size to 256 bits (#1455) +- Remove first parameter (`rng`) of `ReseedingRng::new` (#1533) +- Improve SmallRng initialization performance (#1482) ### Sequences -- Simpler and faster implementation of Floyd's F2 (#1277). This - changes some outputs from `rand::seq::index::sample` and - `rand::seq::SliceRandom::choose_multiple`. +- Optimize fn `sample_floyd`, affecting output of `rand::seq::index::sample` and `rand::seq::SliceRandom::choose_multiple` (#1277) - New, faster algorithms for `IteratorRandom::choose` and `choose_stable` (#1268) - New, faster algorithms for `SliceRandom::shuffle` and `partial_shuffle` (#1272) -- Re-introduce `Rng::gen_iter` (#1305) - Split trait `SliceRandom` into `IndexedRandom`, `IndexedMutRandom`, `SliceRandom` (#1382) +- Add `IndexedRandom::choose_multiple_array`, `index::sample_array` (#1453, #1469) +- Fix `IndexdRandom::choose_multiple_weighted` for very small seeds and optimize for large input length / low memory (#1530) ### Distributions -- `{Uniform, UniformSampler}::{new, new_inclusive}` return a `Result` (instead of potentially panicking) (#1229) -- `Uniform` implements `TryFrom` instead of `From` for ranges (#1229) -- `Uniform` now uses Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287) +- Rename module `rand::distributions` to `rand::distr` (#1470) - Relax `Sized` bound on `Distribution for &D` (#1278) -- Explicit impl of `sample_single_inclusive` (+~20% perf) (#1289) -- Impl `DistString` for `Slice` and `Uniform` (#1315) -- Let `Standard` support all `NonZero*` types (#1332) -- Add `trait Weight`, allowing `WeightedIndex` to trap overflow (#1353) -- Rename `WeightedError` to `WeightError`, revising variants (#1382) +- Rename distribution `Standard` to `StandardUniform` (#1526) +- Remove impl of `Distribution>` for `StandardUniform` (#1526) +- Let distribution `StandardUniform` support all `NonZero*` types (#1332) +- Fns `{Uniform, UniformSampler}::{new, new_inclusive}` return a `Result` (instead of potentially panicking) (#1229) +- Distribution `Uniform` implements `TryFrom` instead of `From` for ranges (#1229) +- Optimize distribution `Uniform`: use Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287) +- Add `UniformUsize` and use to make `Uniform` for `usize` portable (#1487) +- Optimize fn `sample_single_inclusive` for floats (+~20% perf) (#1289) +- Allow `UniformFloat::new` samples and `UniformFloat::sample_single` to yield `high` (#1462) +- Add impl `DistString` for distributions `Slice` and `Uniform` (#1315) +- Add fn `Slice::num_choices` (#1402) +- Fix portability of distribution `Slice` (#1469) +- Add trait `Weight`, allowing `WeightedIndex` to trap overflow (#1353) +- Add fns `weight, weights, total_weight` to distribution `WeightedIndex` (#1420) +- Rename enum `WeightedError` to `WeightError`, revising variants (#1382) and mark as `#[non_exhaustive]` (#1480) +- Add fn `p()` for distribution `Bernoulli` to access probability (#1481) ### SIMD - Switch to `std::simd`, expand SIMD & docs (#1239) - Optimise SIMD widening multiply (#1247) -### Other -- Bump MSRV to 1.60.0 (#1207, #1246, #1269, #1341) -- Improve `thread_rng` related docs (#1257) +### Documentation - Add `Cargo.lock.msrv` file (#1275) - Docs: enable experimental `--generate-link-to-definition` feature (#1327) -- Use `zerocopy` to replace some `unsafe` code (#1349) -- Support `std` feature without `getrandom` or `rand_chacha` (#1354) +- Better doc of crate features, use `doc_auto_cfg` (#1411, #1450) + +### Other +- Reformat with `rustfmt` and enforce (#1448) +- Apply Clippy suggestions and enforce (#1448, #1474) +- Move all benchmarks to new `benches` crate (#1329, #1439) and migrate to Criterion (#1490) ## [0.8.5] - 2021-08-20 ### Fixes diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 36b9ea50d0..66921820c1 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -377,7 +377,7 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" dependencies = [ "bincode", "log", @@ -391,7 +391,7 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" dependencies = [ "ppv-lite86", "rand_core", @@ -401,7 +401,7 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" dependencies = [ "getrandom", "serde", @@ -410,7 +410,7 @@ dependencies = [ [[package]] name = "rand_distr" -version = "0.5.0-alpha.1" +version = "0.5.0-beta.0" dependencies = [ "average", "num-traits", @@ -423,7 +423,7 @@ dependencies = [ [[package]] name = "rand_pcg" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" dependencies = [ "bincode", "rand_core", diff --git a/Cargo.toml b/Cargo.toml index b5b254ba2a..e11e7b1c42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" authors = ["The Rand Project Developers", "The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -69,14 +69,14 @@ members = [ exclude = ["benches", "distr_test"] [dependencies] -rand_core = { path = "rand_core", version = "=0.9.0-alpha.1", default-features = false } +rand_core = { path = "rand_core", version = "=0.9.0-beta.0", default-features = false } log = { version = "0.4.4", optional = true } serde = { version = "1.0.103", features = ["derive"], optional = true } -rand_chacha = { path = "rand_chacha", version = "=0.9.0-alpha.1", default-features = false, optional = true } +rand_chacha = { path = "rand_chacha", version = "=0.9.0-beta.0", default-features = false, optional = true } zerocopy = { version = "0.8.0", default-features = false, features = ["simd"] } [dev-dependencies] -rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } +rand_pcg = { path = "rand_pcg", version = "=0.9.0-beta.0" } # Only to test serde bincode = "1.2.1" rayon = "1.7" diff --git a/README.md b/README.md index 0ac3aaac18..dc8fc78016 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,17 @@ Documentation: ## Usage Add this to your `Cargo.toml`: - ```toml [dependencies] rand = "0.8.5" ``` +Or, to try the 0.9.0 beta release: +```toml +[dependencies] +rand = "=0.9.0-beta.0" +``` + To get started using Rand, see [The Book](https://rust-random.github.io/book). ## Versions diff --git a/benches/benches/seq_choose.rs b/benches/benches/seq_choose.rs index a664b91501..8f19caf7e2 100644 --- a/benches/benches/seq_choose.rs +++ b/benches/benches/seq_choose.rs @@ -52,6 +52,33 @@ pub fn bench(c: &mut Criterion) { }); } + let lens = [(1, 1000), (950, 1000), (10, 100), (90, 100)]; + for (amount, len) in lens { + let name = format!("seq_slice_choose_multiple_weighted_{}_of_{}", amount, len); + c.bench_function(name.as_str(), |b| { + let mut rng = Pcg32::from_rng(&mut rand::rng()); + let mut buf = [0i32; 1000]; + rng.fill(&mut buf); + let x = black_box(&buf[..len]); + + let mut results_buf = [0i32; 950]; + let y = black_box(&mut results_buf[..amount]); + let amount = black_box(amount); + + b.iter(|| { + // Collect full result to prevent unwanted shortcuts getting + // first element (in case sample_indices returns an iterator). + let samples_iter = x + .choose_multiple_weighted(&mut rng, amount, |_| 1.0) + .unwrap(); + for (slot, sample) in y.iter_mut().zip(samples_iter) { + *slot = *sample; + } + y[amount - 1] + }) + }); + } + c.bench_function("seq_iter_choose_multiple_10_of_100", |b| { let mut rng = Pcg32::from_rng(&mut rand::rng()); let mut buf = [0i32; 100]; diff --git a/distr_test/Cargo.toml b/distr_test/Cargo.toml index 36314b37cf..4f85d5b9f7 100644 --- a/distr_test/Cargo.toml +++ b/distr_test/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" publish = false [dev-dependencies] -rand_distr = { path = "../rand_distr", version = "=0.5.0-alpha.1", default-features = false, features = ["alloc"] } -rand = { path = "..", version = "=0.9.0-alpha.1", features = ["small_rng"] } +rand_distr = { path = "../rand_distr", version = "=0.5.0-beta.0", default-features = false, features = ["alloc"] } +rand = { path = "..", version = "=0.9.0-beta.0", features = ["small_rng"] } num-traits = "0.2.19" # Special functions for testing distributions special = "0.11.0" diff --git a/rand_chacha/CHANGELOG.md b/rand_chacha/CHANGELOG.md index 68dba7dfdc..af8aa1f9ec 100644 --- a/rand_chacha/CHANGELOG.md +++ b/rand_chacha/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] -- The `serde1` feature has been renamed `serde` (#1477) -- Rename feature `getrandom` to `os_rng` - -## [0.9.0-alpha.1] - 2024-03-18 - -## [0.9.0-alpha.0] - 2024-02-18 -This is a pre-release. To depend on this version, use `rand_chacha = "=0.9.0-alpha.0"` to prevent automatic updates (which can be expected to include breaking changes). +## [0.9.0-beta.0] - 2024-11-25 +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). - Made `rand_chacha` propagate the `std` feature down to `rand_core` (#1153) - Remove usage of `unsafe` in `fn generate` (#1181) then optimise for AVX2 (~4-7%) (#1192) +- The `serde1` feature has been renamed `serde` (#1477) +- Revise crate docs (#1454) +- Rename feature `getrandom` to `os_rng` (#1537) ## [0.3.1] - 2021-06-09 - add getters corresponding to existing setters: `get_seed`, `get_stream` (#1124) diff --git a/rand_chacha/Cargo.toml b/rand_chacha/Cargo.toml index 168b39def5..096d77c9b7 100644 --- a/rand_chacha/Cargo.toml +++ b/rand_chacha/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_chacha" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" authors = ["The Rand Project Developers", "The Rust Project Developers", "The CryptoCorrosion Contributors"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -20,14 +20,14 @@ all-features = true rustdoc-args = ["--generate-link-to-definition"] [dependencies] -rand_core = { path = "../rand_core", version = "=0.9.0-alpha.1" } +rand_core = { path = "../rand_core", version = "=0.9.0-beta.0" } ppv-lite86 = { version = "0.2.14", default-features = false, features = ["simd"] } serde = { version = "1.0", features = ["derive"], optional = true } [dev-dependencies] # Only to test serde serde_json = "1.0" -rand_core = { path = "../rand_core", version = "=0.9.0-alpha.1", features = ["os_rng"] } +rand_core = { path = "../rand_core", version = "=0.9.0-beta.0", features = ["os_rng"] } [features] default = ["std"] diff --git a/rand_core/CHANGELOG.md b/rand_core/CHANGELOG.md index a2d60c2da1..b22a6ea34c 100644 --- a/rand_core/CHANGELOG.md +++ b/rand_core/CHANGELOG.md @@ -4,21 +4,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] -- Bump the MSRV to 1.63.0 -- The `serde1` feature has been renamed `serde` (#1477) -- Rename feature `getrandom` to `os_rng` - -## [0.9.0-alpha.1] - 2024-03-18 +## [0.9.0-beta.0] - 2024-11-25 +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). -## [0.9.0-alpha.0] - 2024-02-18 -This is a pre-release. To depend on this version, use `rand_core = "=0.9.0-alpha.0"` to prevent automatic updates (which can be expected to include breaking changes). +### Compilation options and unsafe +- 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` +- The `serde1` feature has been renamed `serde` (#1477) +- Use `zerocopy` to replace some `unsafe` code (#1349, #1393, #1446, #1502) -- Bump MSRV to 1.60.0 (#1207, #1246, #1269, #1341) +### Other - Allow `rand_core::impls::fill_via_u*_chunks` to mutate source (#1182) -- Add `fn RngCore::read_adapter` implementing `std::io::Read` (#1267) -- Add `trait CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` (#1273) -- Use `zerocopy` to replace some `unsafe` code (#1349, #1393) +- Add fn `RngCore::read_adapter` implementing `std::io::Read` (#1267) +- Add trait `CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` (#1273) +- Add traits `TryRngCore`, `TryCryptoRng` (#1424, #1499) +- Add bounds `Clone` and `AsRef` to associated type `SeedableRng::Seed` (#1491) +- Rename feature `getrandom` to `os_rng` (#1537) ## [0.6.4] - 2022-09-15 - Fix unsoundness in `::next_u32` (#1160) diff --git a/rand_core/Cargo.toml b/rand_core/Cargo.toml index 6f11b895a3..5cf21b32a1 100644 --- a/rand_core/Cargo.toml +++ b/rand_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_core" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" authors = ["The Rand Project Developers", "The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/rand_distr/CHANGELOG.md b/rand_distr/CHANGELOG.md index 81b62a1f28..b0e1540d1f 100644 --- a/rand_distr/CHANGELOG.md +++ b/rand_distr/CHANGELOG.md @@ -4,44 +4,47 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.5.0-beta.0] - 2024-11-25 +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). + +### Compilation options +- Target `rand` version `0.9.0-beta.0` +- Bump the MSRV to 1.61.0 (#1207, #1246, #1269, #1341, #1416); note that 1.60.0 may work for dependents when using `--ignore-rust-version` - The `serde1` feature has been renamed `serde` (#1477) + +### Testing +- Add Kolmogorov Smirnov tests for distributions (#1494, #1504, #1525, #1530) + +### Fixes +- Fix Knuth's method so `Poisson` doesn't return -1.0 for small lambda (#1284) +- Fix `Poisson` distribution instantiation so it return an error if lambda is infinite (#1291) +- Fix Dirichlet sample for small alpha values to avoid NaN samples (#1209) +- Fix infinite loop in `Binomial` distribution (#1325) - Fix panic in Binomial (#1484) -- Move some of the computations in Binomial from `sample` to `new` (#1484) -- Add Kolmogorov Smirnov test for sampling of `Normal` and `Binomial` (#1494) -- Add Kolmogorov Smirnov test for more distributions (#1504) -- Mark `WeightError`, `PoissonError`, `BinomialError` as `#[non_exhaustive]` (#1480). -- Remove support for generating `isize` and `usize` values with `Standard`, `Uniform` and `Fill` and usage as a `WeightedAliasIndex` weight (#1487) - Limit the maximal acceptable lambda for `Poisson` to solve (#1312) (#1498) - Fix bug in `Hypergeometric`, this is a Value-breaking change (#1510) -- Change parameter type of `Zipf::new`: `n` is now floating-point (#1518) - -### Added -- Add plots for `rand_distr` distributions to documentation (#1434) -- Add `PertBuilder`, fix case where mode ≅ mean (#1452) - -## [0.5.0-alpha.1] - 2024-03-18 -- Target `rand` version `0.9.0-alpha.1` - -## [0.5.0-alpha.0] - 2024-02-18 -This is a pre-release. To depend on this version, use `rand_distr = "=0.5.0-alpha.0"` to prevent automatic updates (which can be expected to include breaking changes). ### Additions - Make distributions comparable with `PartialEq` (#1218) -- Add `WeightedIndexTree` (#1372) +- Add `WeightedIndexTree` (#1372, #1444) ### Changes -- Target `rand` version `0.9.0-alpha.0` +### Other changes - Remove unused fields from `Gamma`, `NormalInverseGaussian` and `Zipf` distributions (#1184) This breaks serialization compatibility with older versions. - `Dirichlet` now uses `const` generics, which means that its size is required at compile time (#1292) - The `Dirichlet::new_with_size` constructor was removed (#1292) +- Add `PertBuilder`, fix case where mode ≅ mean (#1452) +- Rename `Zeta`'s parameter `a` to `s` (#1466) +- Mark `WeightError`, `PoissonError`, `BinomialError` as `#[non_exhaustive]` (#1480) +- Remove support for usage of `isize` as a `WeightedAliasIndex` weight (#1487) +- Change parameter type of `Zipf::new`: `n` is now floating-point (#1518) -### Fixes -- Fix Knuth's method so `Poisson` doesn't return -1.0 for small lambda (#1284) -- Fix `Poisson` distribution instantiation so it return an error if lambda is infinite (#1291) -- Fix Dirichlet sample for small alpha values to avoid NaN samples (#1209) -- Fix infinite loop in `Binomial` distribution (#1325) +### Optimizations +- Move some of the computations in Binomial from `sample` to `new` (#1484) + +### Documentation +- Add plots for `rand_distr` distributions to documentation (#1434) ## [0.4.3] - 2021-12-30 - Fix `no_std` build (#1208) diff --git a/rand_distr/Cargo.toml b/rand_distr/Cargo.toml index 211d30c0f2..e20bcb319c 100644 --- a/rand_distr/Cargo.toml +++ b/rand_distr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_distr" -version = "0.5.0-alpha.1" +version = "0.5.0-beta.0" authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -32,15 +32,15 @@ std_math = ["num-traits/std"] serde = ["dep:serde", "dep:serde_with", "rand/serde"] [dependencies] -rand = { path = "..", version = "=0.9.0-alpha.1", default-features = false } +rand = { path = "..", version = "=0.9.0-beta.0", default-features = false } num-traits = { version = "0.2", default-features = false, features = ["libm"] } serde = { version = "1.0.103", features = ["derive"], optional = true } serde_with = { version = ">= 3.0, <= 3.11", optional = true } [dev-dependencies] -rand_pcg = { version = "=0.9.0-alpha.1", path = "../rand_pcg" } +rand_pcg = { version = "=0.9.0-beta.0", path = "../rand_pcg" } # For inline examples -rand = { path = "..", version = "=0.9.0-alpha.1", features = ["small_rng"] } +rand = { path = "..", version = "=0.9.0-beta.0", features = ["small_rng"] } # Histogram implementation for testing uniformity average = { version = "0.15", features = [ "std" ] } # Special functions for testing distributions diff --git a/rand_pcg/CHANGELOG.md b/rand_pcg/CHANGELOG.md index 0133909a97..5b9cd14005 100644 --- a/rand_pcg/CHANGELOG.md +++ b/rand_pcg/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] -- The `serde1` feature has been renamed `serde` (#1477) -- Rename feature `getrandom` to `os_rng` - -## [0.9.0-alpha.1] - 2024-03-18 - -## [0.9.0-alpha.0] - 2024-02-18 -This is a pre-release. To depend on this version, use `rand_pcg = "=0.9.0-alpha.0"` to prevent automatic updates (which can be expected to include breaking changes). +## [0.9.0-beta.0] - 2024-11-25 +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). +- The `serde1` feature has been renamed `serde` (#1477) - Add `Lcg128CmDxsm64` generator compatible with NumPy's `PCG64DXSM` (#1202) - Add examples for initializing the RNGs +- Revise crate docs (#1454) +- Rename feature `getrandom` to `os_rng` (#1537) ## [0.3.1] - 2021-06-15 - Add `advance` methods to RNGs (#1111) diff --git a/rand_pcg/Cargo.toml b/rand_pcg/Cargo.toml index fb4dd17b00..e490c1bc1a 100644 --- a/rand_pcg/Cargo.toml +++ b/rand_pcg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_pcg" -version = "0.9.0-alpha.1" +version = "0.9.0-beta.0" authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -24,7 +24,7 @@ serde = ["dep:serde"] os_rng = ["rand_core/os_rng"] [dependencies] -rand_core = { path = "../rand_core", version = "=0.9.0-alpha.1" } +rand_core = { path = "../rand_core", version = "=0.9.0-beta.0" } serde = { version = "1", features = ["derive"], optional = true } [dev-dependencies] @@ -32,4 +32,4 @@ serde = { version = "1", features = ["derive"], optional = true } # deps yet, see: https://github.com/rust-lang/cargo/issues/1596 # Versions prior to 1.1.4 had incorrect minimal dependencies. bincode = { version = "1.1.4" } -rand_core = { path = "../rand_core", version = "=0.9.0-alpha.1", features = ["os_rng"] } +rand_core = { path = "../rand_core", version = "=0.9.0-beta.0", features = ["os_rng"] } diff --git a/src/distr/integer.rs b/src/distr/integer.rs index f20f34e0eb..d0040e69e7 100644 --- a/src/distr/integer.rs +++ b/src/distr/integer.rs @@ -187,6 +187,17 @@ mod tests { rng.sample::(StandardUniform); } + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[test] + fn x86_integers() { + let mut rng = crate::test::rng(807); + + rng.sample::<__m128i, _>(StandardUniform); + rng.sample::<__m256i, _>(StandardUniform); + #[cfg(feature = "simd_support")] + rng.sample::<__m512i, _>(StandardUniform); + } + #[test] fn value_stability() { fn test_samples(zero: T, expected: &[T])