# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.10.0] - 2026-02-01

This release makes a number of significant changes which we hope will be the
last significant breakage before 1.0. Code has moved from the [rust-random/rand]
repository to its own [rust-random/rand_core].

### User-facing API changes

#### Changed
- Edition changed to 2024 and MSRV bumped to 1.85 ([rand#1668])
- `RngCore` and `TryRngCore` are renamed to `Rng` and `TryRng` respectively ([#54])
- `Rng` is now an extension trait of `TryRng<Error = Infallible>` ([#45])
- `TryRng::Error` is bound on `core::error::Error` instead of `Debug + Display` ([#58])
- Relax `Sized` bound on impls of `SeedableRng` ([rand#1641])

#### Added
- `SeedableRng::{fork, try_fork}` methods ([#17])
- Re-export of `core::convert::Infallible` ([#56])

#### Removed
- `TryRng::read_adapter` method (replaced with `rand::RngReader`) ([rand#1669])
- `os_rng` crate feature ([rand#1674])
- `OsRng` and `OsError` structs ([rand#1674])
- `SeedableRng::from_os_rng` and `SeedableRng::try_from_os_rng` methods ([rand#1674])
- `getrandom` dependency ([rand#1674])
- `std` crate feature ([rand#1674])
- Optional `serde` dependency ([#28])
- `UnwrapMut` struct and `Rng::unwrap_mut` method ([#45])
- `Rng::unwrap_err` method in favor of explicit wrapping in `UnwrapErr` ([#53])

### API changes to PRNG implementation helpers

### Added
- `BlockRng::reconstruct` and `BlockRng::remaining_results` methods ([#36])
- `block::Generator::drop` method ([#35])
- `BlockRng::word_offset` method ([#44])

### Changed
- Replaced `le` helper functions with new `utils` helpers ([rand#1667], [#34], [#38], [#45])
- Rename `BlockRng::generate_and_set` method to `reset_and_skip` ([#44])
- Rename `block::BlockRngCore` trait to `block::Generator` ([#26])
- Rename `BlockRngCore::Results` associated type to `Output` and remove type bounds on it ([#26])

### Removed
- Implementation of `Rng` for `BlockRng`, making the latter more generic ([#34])
- `BlockRng64` struct ([#34])
- `BlockRng::reset` method ([#44])
- `BlockRng::index` method (replaced with `BlockRng::word_offset`) ([#44])
- `Generator::Item` associated type ([#26])
- `CryptoBlockRng` ([#69])

[0.10.0]: https://github.com/rust-random/rand_core/compare/v0.9.3...HEAD

[rand#1641]: https://github.com/rust-random/rand/pull/1641
[rand#1667]: https://github.com/rust-random/rand/pull/1667
[rand#1668]: https://github.com/rust-random/rand/pull/1668
[rand#1669]: https://github.com/rust-random/rand/pull/1669
[rand#1674]: https://github.com/rust-random/rand/pull/1674
[#17]: https://github.com/rust-random/rand_core/pull/17
[#26]: https://github.com/rust-random/rand_core/pull/28
[#28]: https://github.com/rust-random/rand_core/pull/28
[#34]: https://github.com/rust-random/rand_core/pull/34
[#35]: https://github.com/rust-random/rand_core/pull/35
[#36]: https://github.com/rust-random/rand_core/pull/36
[#38]: https://github.com/rust-random/rand_core/pull/38
[#44]: https://github.com/rust-random/rand_core/pull/44
[#45]: https://github.com/rust-random/rand_core/pull/45
[#53]: https://github.com/rust-random/rand_core/pull/53
[#54]: https://github.com/rust-random/rand_core/pull/54
[#56]: https://github.com/rust-random/rand_core/pull/56
[#58]: https://github.com/rust-random/rand_core/pull/58
[#69]: https://github.com/rust-random/rand_core/pull/69

[rust-random/rand]: https://github.com/rust-random/rand
[rust-random/rand_core]: https://github.com/rust-random/rand_core

## [0.9.3] - 2025-02-29
### Other
- Remove `zerocopy` dependency ([rand#1607])
- Deprecate `rand_core::impls::fill_via_u32_chunks`, `fill_via_u64_chunks` ([rand#1607])

[0.9.3]: https://github.com/rust-random/rand_core/compare/v0.9.2...v0.9.3

[rand#1607]: https://github.com/rust-random/rand/pull/1607

## [0.9.2] - 2025-02-22
### API changes
- Relax `Sized` bound on impls of `TryRngCore`, `TryCryptoRng` and `UnwrapMut` ([rand#1593])
- Add `UnwrapMut::re` to reborrow the inner rng with a tighter lifetime ([rand#1595])

[0.9.2]: https://github.com/rust-random/rand_core/compare/v0.9.1...v0.9.2

[rand#1593]: https://github.com/rust-random/rand/pull/1593
[rand#1595]: https://github.com/rust-random/rand/pull/1595

## [0.9.1] - 2025-02-16
### API changes
- Add `TryRngCore::unwrap_mut`, providing an impl of `RngCore` over `&mut rng` ([rand#1589])

[0.9.1]: https://github.com/rust-random/rand_core/compare/v0.9.0...v0.9.1

[rand#1589]: https://github.com/rust-random/rand/pull/1589

## [0.9.0] - 2025-01-27
### Dependencies and features
- Bump the MSRV to 1.63.0 ([rand#1536]); note that 1.60.0 may work for dependents when using `--ignore-rust-version`
- Update to `getrandom` v0.3.0 ([rand#1558])
- Use `zerocopy` to replace some `unsafe` code ([rand#1349], [rand#1393], [rand#1446], [rand#1502])
- Rename feature `serde1` to `serde` ([rand#1477])
- Rename feature `getrandom` to `os_rng` ([rand#1537])

### API changes
- Allow `rand_core::impls::fill_via_u*_chunks` to mutate source ([rand#1182])
- Add fn `RngCore::read_adapter` implementing `std::io::Read` ([rand#1267])
- Add trait `CryptoBlockRng: BlockRngCore`; make `trait CryptoRng: RngCore` replacing `CryptoRngCore` ([rand#1273])
- Add traits `TryRngCore`, `TryCryptoRng` ([rand#1424], [rand#1499])
- Rename `fn SeedableRng::from_rng` -> `try_from_rng` and add infallible variant `fn from_rng` ([rand#1424])
- Rename `fn SeedableRng::from_entropy` -> `from_os_rng` and add fallible variant `fn try_from_os_rng` ([rand#1424])
- Add bounds `Clone` and `AsRef` to associated type `SeedableRng::Seed` ([rand#1491])

[0.9.0]: https://github.com/rust-random/rand_core/compare/v0.6.4...v0.9.0

[rand#1182]: https://github.com/rust-random/rand/pull/1182
[rand#1267]: https://github.com/rust-random/rand/pull/1267
[rand#1273]: https://github.com/rust-random/rand/pull/1273
[rand#1349]: https://github.com/rust-random/rand/pull/1349
[rand#1393]: https://github.com/rust-random/rand/pull/1393
[rand#1424]: https://github.com/rust-random/rand/pull/1424
[rand#1446]: https://github.com/rust-random/rand/pull/1446
[rand#1477]: https://github.com/rust-random/rand/pull/1477
[rand#1491]: https://github.com/rust-random/rand/pull/1491
[rand#1499]: https://github.com/rust-random/rand/pull/1499
[rand#1502]: https://github.com/rust-random/rand/pull/1502
[rand#1536]: https://github.com/rust-random/rand/pull/1536
[rand#1537]: https://github.com/rust-random/rand/pull/1537
[rand#1558]: https://github.com/rust-random/rand/pull/1558

## [0.6.4] - 2022-09-15
- Fix unsoundness in `<BlockRng64 as RngCore>::next_u32` ([rand#1160])
- Reduce use of `unsafe` and improve gen_bytes performance ([rand#1180])
- Add `CryptoRngCore` trait ([rand#1187], [rand#1230])

[0.6.4]: https://github.com/rust-random/rand_core/compare/v0.6.3...v0.6.4

[rand#1160]: https://github.com/rust-random/rand/pull/1160
[rand#1180]: https://github.com/rust-random/rand/pull/1180
[rand#1187]: https://github.com/rust-random/rand/pull/1187
[rand#1230]: https://github.com/rust-random/rand/pull/1230

## [0.6.3] - 2021-06-15
### Changed
- Improved bound for `serde` impls on `BlockRng` ([rand#1130])
- Minor doc additions ([rand#1118])

[0.6.3]: https://github.com/rust-random/rand_core/compare/v0.6.2...v0.6.3

[rand#1118]: https://github.com/rust-random/rand/pull/1118
[rand#1130]: https://github.com/rust-random/rand/pull/1130

## [0.6.2] - 2021-02-12
### Fixed
- Fixed assertions in `le::read_u32_into` and `le::read_u64_into` which could
  have allowed buffers not to be fully populated ([rand#1096])

[0.6.2]: https://github.com/rust-random/rand_core/compare/v0.6.1...v0.6.2

[rand#1096]: https://github.com/rust-random/rand/pull/1096

## [0.6.1] - 2021-01-03
### Fixed
- Avoid panic when using `RngCore::seed_from_u64` with a seed which is not a
  multiple of four ([rand#1082])
### Other
- Enable all stable features in the playground ([rand#1081])

[0.6.1]: https://github.com/rust-random/rand_core/compare/v0.6.0...v0.6.1

[rand#1081]: https://github.com/rust-random/rand/pull/1081
[rand#1082]: https://github.com/rust-random/rand/pull/1082

## [0.6.0] - 2020-12-08
### Breaking changes
- Bump MSRV to 1.36, various code improvements ([rand#1011])
- Update to getrandom v0.2 ([rand#1041])
- Fix: `next_u32_via_fill` and `next_u64_via_fill` now use LE as documented ([rand#1061])

### Other
- Reduce usage of `unsafe` ([rand#962], [rand#963], [rand#1011])
- Annotate feature-gates in documentation ([rand#1019])
- Document available error codes ([rand#1061])
- Various documentation tweaks
- Fix some clippy warnings ([rand#1036])
- Apply rustfmt ([rand#926])

[0.6.0]: https://github.com/rust-random/rand_core/compare/v0.5.1...v0.6.0

[rand#926]: https://github.com/rust-random/rand/pull/926
[rand#962]: https://github.com/rust-random/rand/pull/962
[rand#963]: https://github.com/rust-random/rand/pull/963
[rand#1011]: https://github.com/rust-random/rand/pull/1011
[rand#1019]: https://github.com/rust-random/rand/pull/1019
[rand#1036]: https://github.com/rust-random/rand/pull/1036
[rand#1041]: https://github.com/rust-random/rand/pull/1041
[rand#1061]: https://github.com/rust-random/rand/pull/1061

## [0.5.1] - 2019-08-28
- `OsRng` added to `rand_core` ([rand#863])
- `Error::INTERNAL_START` and `Error::CUSTOM_START` constants ([rand#864])
- `Error::raw_os_error` method ([rand#864])
- `Debug` and `Display` formatting for `getrandom` error codes without `std` ([rand#864])
### Changed
- `alloc` feature in `no_std` is available since Rust 1.36 ([rand#856])
- Added `#[inline]` to `Error` conversion methods ([rand#864])

[0.5.1]: https://github.com/rust-random/rand_core/compare/v0.5.0...v0.5.1

[rand#863]: https://github.com/rust-random/rand/pull/863
[rand#864]: https://github.com/rust-random/rand/pull/864
[rand#856]: https://github.com/rust-random/rand/pull/856
[rand#864]: https://github.com/rust-random/rand/pull/864

## [0.5.0] - 2019-06-06
### Changed
- Enable testing with Miri and fix incorrect pointer usages ([rand#779], [rand#780], [rand#781], [rand#783], [rand#784])
- Rewrite `Error` type and adjust API ([rand#800])
- Adjust usage of `#[inline]` for `BlockRng` and `BlockRng64`

[0.5.0]: https://github.com/rust-random/rand_core/compare/v0.4.0...v0.5.0

[rand#779]: https://github.com/rust-random/rand/pull/779
[rand#780]: https://github.com/rust-random/rand/pull/780
[rand#781]: https://github.com/rust-random/rand/pull/781
[rand#783]: https://github.com/rust-random/rand/pull/783
[rand#784]: https://github.com/rust-random/rand/pull/784
[rand#800]: https://github.com/rust-random/rand/pull/800

## [0.4.0] - 2019-01-24
### Changed
- Disable the `std` feature by default ([rand#702])

[0.4.0]: https://github.com/rust-random/rand_core/compare/v0.3.0...v0.4.0

[rand#702]: https://github.com/rust-random/rand/pull/702

## [0.3.0] - 2018-09-24
### Added
- Add `SeedableRng::seed_from_u64` for convenient seeding. ([rand#537])

[0.3.0]: https://github.com/rust-random/rand_core/compare/v0.2.1...v0.3.0

[rand#537]: https://github.com/rust-random/rand/pull/537

## [0.2.1] - 2018-06-08
### Added
- References to a `CryptoRng` now also implement `CryptoRng`. ([rand#470])

[0.2.1]: https://github.com/rust-random/rand_core/compare/v0.2.0...v0.2.1

[rand#470]: https://github.com/rust-random/rand/pull/470

## [0.2.0] - 2018-05-21
### Changed
- Enable the `std` feature by default. ([rand#409])
- Remove `BlockRng{64}::inner` and `BlockRng::inner_mut`; instead making `core` public
- Change `BlockRngCore::Results` bound to also require `AsMut<[Self::Item]>`. ([rand#419])
### Added
- Add `BlockRng{64}::index` and `BlockRng{64}::generate_and_set`. ([rand#374], [rand#419])
- Implement `std::io::Read` for RngCore. ([rand#434])

[0.2.0]: https://github.com/rust-random/rand_core/compare/v0.1.0...v0.2.0

[rand#374]: https://github.com/rust-random/rand/pull/374
[rand#409]: https://github.com/rust-random/rand/pull/409
[rand#419]: https://github.com/rust-random/rand/pull/419
[rand#434]: https://github.com/rust-random/rand/pull/434

## [0.1.0] - 2018-04-17
(Split out of the Rand crate, changes here are relative to rand 0.4.2.)
### Added
- `RngCore` and `SeedableRng` are now part of `rand_core`. ([rand#288])
- Add modules to help implementing RNGs `impl` and `le`. ([rand#209], [rand#228])
- Add `Error` and `ErrorKind`. ([rand#225])
- Add `CryptoRng` marker trait. ([rand#273])
- Add `BlockRngCore` trait. ([rand#281])
- Add `BlockRng` and `BlockRng64` wrappers to help implementations. ([rand#281], [rand#325])
- Add `RngCore::try_fill_bytes`. ([rand#225])
### Changed
- Revise the `SeedableRng` trait. ([rand#233])
- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. ([rand#288])

[0.1.0]: https://github.com/rust-random/rand_core/compare/v0.0.0...v0.1.0

[rand#209]: https://github.com/rust-random/rand/pull/209
[rand#225]: https://github.com/rust-random/rand/pull/225
[rand#228]: https://github.com/rust-random/rand/pull/228
[rand#233]: https://github.com/rust-random/rand/pull/233
[rand#273]: https://github.com/rust-random/rand/pull/273
[rand#281]: https://github.com/rust-random/rand/pull/281
[rand#288]: https://github.com/rust-random/rand/pull/288
[rand#325]: https://github.com/rust-random/rand/pull/325
