noiseHash2 function Noise

int noiseHash2(
  1. int seed,
  2. int x,
  3. int y
)

Bit-exact hashed value for the integer lattice cell (x, y).

Pure 32-bit integer math, guaranteed to produce the same signed 32-bit result as the GLSL NoiseHash2(ivec2(x, y), seed) on every backend (and between native and web Dart). Use it for decisions that must never disagree between the CPU and a shader.

Implementation

int noiseHash2(int seed, int x, int y) =>
    _hash2(_i32(seed), _i32(_i32(x) * _primeX), _i32(_i32(y) * _primeY));