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>;
|
pub type HashSet<K> = std::collections::HashSet<K, RandomState>;
|
||||||
|
|
||||||
/// Random hasher state.
|
/// Random hasher state.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RandomState {
|
pub struct RandomState {
|
||||||
key1: u64,
|
key1: u64,
|
||||||
key2: u64,
|
key2: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for RandomState {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new(fastrand::Rng::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl RandomState {
|
impl RandomState {
|
||||||
fn new(rng: fastrand::Rng) -> Self {
|
fn new(rng: fastrand::Rng) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue