beacon_chain/utils/shuffling: Introduce test vectors from sigp/shuffling_sandbox

Also:
 - return early if we shuffle an empty list
 - change RAND_MAX as per spec
This commit is contained in:
pinkiebell
2018-10-20 18:39:10 +02:00
parent 2fb9dfbf14
commit 5252b54a04
4 changed files with 212 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ use super::hashing::canonical_hash;
const SEED_SIZE_BYTES: usize = 32;
const RAND_BYTES: usize = 3; // 24 / 8
const RAND_MAX: u32 = 16_777_216; // 2**24
const RAND_MAX: u32 = 16_777_215; // 2 ** (rand_bytes * 8) - 1
/// A pseudo-random number generator which given a seed
/// uses successive blake2s hashing to generate "entropy".