Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Better default for `RandomState`
Alexis Sellier committed 3 years ago
commit 5c41af060f16d8c47bb4c26b881fec91c93fa268
parent 5e0d4653c7e0c4114aea8e3a3d2b4948d6cf5b88
1 file changed +7 -1
modified node/src/collections.rs
@@ -8,12 +8,18 @@ pub type HashMap<K, V> = std::collections::HashMap<K, V, RandomState>;
pub type HashSet<K> = std::collections::HashSet<K, RandomState>;

/// 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 {