diff --git a/src/xoroshiro128.rs b/src/xoroshiro128.rs index f5b5232..1f891f3 100644 --- a/src/xoroshiro128.rs +++ b/src/xoroshiro128.rs @@ -96,8 +96,8 @@ impl<'a> SeedableRng<&'a [u64]> for Xoroshiro128 { impl Rand for Xoroshiro128 { fn rand(other: &mut R) -> Xoroshiro128 { let mut key: [u64; STATE_SIZE] = [0; STATE_SIZE]; - for word in &mut key { - *word = other.gen(); + while key.iter().all(|&x| x == 0) { + key = other.gen(); } SeedableRng::from_seed(&key[..]) }