From 5c41af060f16d8c47bb4c26b881fec91c93fa268 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 29 Aug 2022 11:16:08 +0200 Subject: [PATCH] node: Better default for `RandomState` Signed-off-by: Alexis Sellier --- node/src/collections.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/src/collections.rs b/node/src/collections.rs index b464f388..6e30f2b1 100644 --- a/node/src/collections.rs +++ b/node/src/collections.rs @@ -8,12 +8,18 @@ pub type HashMap = std::collections::HashMap; pub type HashSet = std::collections::HashSet; /// Random hasher state. -#[derive(Default, Clone)] +#[derive(Clone)] pub struct RandomState { key1: u64, key2: u64, } +impl Default for RandomState { + fn default() -> Self { + Self::new(fastrand::Rng::new()) + } +} + impl RandomState { fn new(rng: fastrand::Rng) -> Self { Self {