Skip to content

Commit

Permalink
Fix #1082 (seed_from_u64 with non multiple of 4)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jan 1, 2021
1 parent 34aa769 commit eb4b8a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rand_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ 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).

## [0.6.1] - 2020-12-31
## [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 (#1082)
### Other
- Enable all stable features in the playground (#1081)

Expand Down
2 changes: 1 addition & 1 deletion rand_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ pub trait SeedableRng: Sized {
let xorshifted = (((state >> 18) ^ state) >> 27) as u32;
let rot = (state >> 59) as u32;
let x = xorshifted.rotate_right(rot);
chunk.copy_from_slice(&x.to_le_bytes());
chunk.copy_from_slice(&x.to_le_bytes()[..chunk.len()]);
}

Self::from_seed(seed)
Expand Down

0 comments on commit eb4b8a4

Please sign in to comment.