fix: bit mixing

so the fn was basically $ka + kb + kc + ... = k(a + b + c + d)$, so completely useless, this mixes better, and also position independent

and now my lovely dancing lain falls under the root domain path hash
This commit is contained in:
2026-03-24 14:37:40 +01:00
parent 1c0b5a23d4
commit 4449607449

View File

@@ -11,9 +11,10 @@ fn mix_u32s(seed: impl Iterator<Item = u32>) -> u32 {
const U32_BIT_MIXING_CONSTANT: u32 = 0x7feb_352d;
const U32_SELF_BIT_MIXING: u32 = 0x846c_a68b;
let mut random = seed.fold(0_u32, |acc, e| {
let mut random = seed.fold(0_u32, |mut acc, e| {
// mix bits
acc.wrapping_add(e.wrapping_mul(U32_BIT_MIXING_CONSTANT))
acc ^= e.wrapping_mul(e);
acc.wrapping_mul(U32_BIT_MIXING_CONSTANT).wrapping_add(e)
});
// GPT's suggestion for a nicer distribution, like 8 cpu instructions so whatever