use std::{
cell::Cell,
collections::hash_map::RandomState,
hash::{BuildHasher, Hasher},
};
pub(crate) fn fast_random() -> u64 {
thread_local! {
static KEY: RandomState = RandomState::new();
static COUNTER: Cell<u64> = const { Cell::new(0) };
}
KEY.with(|key| {
COUNTER.with(|ctr| {
let n = ctr.get().wrapping_add(1);
ctr.set(n);
let mut h = key.build_hasher();
h.write_u64(n);
h.finish()
})
})
}