-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
185: Bump rand to 0.8 r=cuviper a=Gelbpunkt This updates rand to 0.8, which is required when working with a 0.8 version in the package since the version needs to match for the trait. Co-authored-by: Jens Reidel <adrian@travitia.xyz> Co-authored-by: Josh Stone <cuviper@gmail.com>
- Loading branch information
Showing
13 changed files
with
68 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use rand::RngCore; | ||
|
||
pub(crate) fn get_rng() -> impl RngCore { | ||
XorShiftStar { | ||
a: 0x0123_4567_89AB_CDEF, | ||
} | ||
} | ||
|
||
/// Simple `Rng` for benchmarking without additional dependencies | ||
struct XorShiftStar { | ||
a: u64, | ||
} | ||
|
||
impl RngCore for XorShiftStar { | ||
fn next_u32(&mut self) -> u32 { | ||
self.next_u64() as u32 | ||
} | ||
|
||
fn next_u64(&mut self) -> u64 { | ||
// https://en.wikipedia.org/wiki/Xorshift#xorshift* | ||
self.a ^= self.a >> 12; | ||
self.a ^= self.a << 25; | ||
self.a ^= self.a >> 27; | ||
self.a.wrapping_mul(0x2545_F491_4F6C_DD1D) | ||
} | ||
|
||
fn fill_bytes(&mut self, dest: &mut [u8]) { | ||
for chunk in dest.chunks_mut(8) { | ||
let bytes = self.next_u64().to_le_bytes(); | ||
let slice = &bytes[..chunk.len()]; | ||
chunk.copy_from_slice(slice) | ||
} | ||
} | ||
|
||
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { | ||
Ok(self.fill_bytes(dest)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
status = [ | ||
"Test (1.31.0)", | ||
"Test (1.32.0)", | ||
"Test (1.34.0)", | ||
"Test (1.36.0)", | ||
"Test (stable)", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters