minhash_rs/splitmix.rs
1//! Module for the SplitMix64 algorithm.
2//!
3//! # What is SplitMix64?
4//! SplitMix64 is a fast, non-cryptographic, pseudo-random number generator.
5
6pub trait SplitMix {
7 fn splitmix(self) -> Self;
8}
9
10impl SplitMix for u64 {
11 fn splitmix(self) -> Self {
12 let mut z = self;
13 z = (z ^ (z >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
14 z = (z ^ (z >> 27)).wrapping_mul(0x94d049bb133111eb);
15 z ^ (z >> 31)
16 }
17}