Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

rand

The lattice hash and the unit random draw the procgen kernels share: zero_proc_fnv_u32, zero_proc_avalanche, zero_proc_unit(prefix, element), and the seeded forms zero_rand(seed, element), zero_rand_range, zero_rand3. The draw equals the CPU hash to the last bit, because it folds the same bytes and mixes with the same decimal constants.

#include "@builtin::systems.procgen.kernels.rand"

fn jitter(id: u32) -> f32 { return zero_rand_range(7u, id, -0.5, 0.5); }

rand.unit(seed, ...scope, id) of the field nodes is zero_proc_unit(prefix, id): the prefix is hash.scopePrefix of the seed and scope folded once on the CPU, so the draw equals hash.unitFloat to the bit.