Quick answer: Combine math.hash calls with prime multiplication. For 10k+ keys, implement xxhash.

Spatial hash grid: collisions cluster, performance degrades. Single math.hash isn't strong enough for large sets.

The Fix

using Unity.Mathematics;

[BurstCompile]
public static class Hashing {
    public static uint Combine(uint a, uint b) =>
        a * 0x27d4eb2du + b;

    public static uint HashCell(int3 cell) =>
        Combine(
            math.hash(cell.xy),
            math.hash(new int2(cell.z, 0)));
}

Combining via prime multiplication decorrelates per-axis hashes. Stronger distribution than raw hash.

Verifying

Collision count drops by 50%+ on test set. Profiler: spatial hash lookup time more uniform.

“Combine. Prime mix. Spread.”

Related Issues

For Burst pointer arith, see pointer. For Burst inlining, see inlining.

Combine + prime. Spread.