noise method

double noise(
  1. int index, [
  2. int offset = 0
])

Returns a deterministic pseudo-random value (0.0–1.0) for the given index and optional offset.

Uses a hash-based function instead of Random so results are reproducible across runs.

index — primary seed for the noise value. offset — secondary offset for multi-frequency noise.

Implementation

double noise(int index, [int offset = 0]) {
  final h = (index * 374761393 + offset * 668265263) & 0x7FFFFFFF;
  return (h % 10000) / 10000.0;
}