Update shuffling to use new(ish) to_le_bytes fn
This commit is contained in:
parent
92610b4fd3
commit
7bf83a97cf
@ -1,8 +1,6 @@
|
||||
use bytes::Buf;
|
||||
use hashing::hash;
|
||||
use int_to_bytes::{int_to_bytes1, int_to_bytes4};
|
||||
use std::cmp::max;
|
||||
use std::io::Cursor;
|
||||
|
||||
/// Return `p(index)` in a pseudorandom permutation `p` of `0...list_size-1` with ``seed`` as entropy.
|
||||
///
|
||||
@ -68,9 +66,10 @@ fn hash_with_round(seed: &[u8], round: u8) -> Vec<u8> {
|
||||
hash(&seed[..])
|
||||
}
|
||||
|
||||
fn bytes_to_int64(bytes: &[u8]) -> u64 {
|
||||
let mut cursor = Cursor::new(bytes);
|
||||
cursor.get_u64_le()
|
||||
fn bytes_to_int64(slice: &[u8]) -> u64 {
|
||||
let mut bytes = [0; 8];
|
||||
bytes.copy_from_slice(&slice[0..8]);
|
||||
u64::from_le_bytes(bytes)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Loading…
Reference in New Issue
Block a user