mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-29 14:00:31 +08:00
node: Better default for RandomState
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user