hash.module
This package holds more than this page lists. See all of its files in its world.
README.md
proc.hash
Deterministic, portable scoped hashing for the procgen evaluator.
scoped(seed, graphId, compositePath, nodeId, channel, elementId) -> number
folds its arguments with 32-bit FNV-1a (via an exact 16-bit-split mul32)
and a final avalanche, producing a bit-identical u32 on native, WASM, and
Android. unitFloat(...) maps the same scope to a value in [0, 1) for
deterministic random draws. scopePrefix(seed, graphId, compositePath, nodeId, channel) folds a scope without its element, and scopedFrom(prefix, elementId)
resumes it to the same number scoped answers.
hashInts(seed, ...) and unitFromInts(seed, ...) hash a seed and integer
coordinates, and latticeCell2 / latticeCell3 (unitCell2 / unitCell3)
answer the corner hashes of one lattice cell, which proc.noise is built on.
valueHash(v) is an order-sensitive structural hash of any acyclic Luau value,
an integer in [0, 2^52) used for content-addressed cache keys, and
valueHashBetween(v, between) is the same digest for a large value, calling
between as it walks.
Integer arithmetic alone decides every answer, so the same inputs hash the same
on every platform. The per-element scope (elementId) keeps a given element's
draw stable as unrelated element counts grow.
local r = proc.hash.unitFloat(42, "cash_pile", "", "scatter", 0, 7)