node: Better default for `RandomState`
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
parent
5e0d4653c7
commit
5c41af060f
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue