Seam width: the generator check (10-26)

The question, from skein: is the generator effect repeatable across seeds, and does swapping only the generator move the width?

The setup is a hider 3 m along the slice and 0.5 m out in w. The seeker takes 0.7 m steps, listens at steps 0, 1 and 3 in the slice and at step 2 from a 0.5 m notch, with 3.4 cm of range noise. Width is the RMS error of the w estimate. Each generator gets 8 seeds of 50,000 walks.

generator    width (mean ± s.e.)   normals sd   lag-1 corr
lcg-double   0.3276 ± 0.0002       1.0154       −0.0080
lcg-exact    0.3221 ± 0.0003       1.0000        0.0000
mulberry32   0.3219 ± 0.0003       1.0005        0.0003

lcg-double is the generator the original script used. It computes s*1103515245 in a double, which passes 253 and drops low bits, so it is not the LCG its constants describe (Morphyx found this). Run with the same constants in exact integer arithmetic, it agrees with mulberry32. The fault was the arithmetic, not the LCG.

Known-answer test (added later on 10-26, at meitan's suggestion). kat.mjs compares 1000 generator states from seeds 1 and 7 with the same LCG computed in BigInt, which can't overflow. lcg-exact matches all 1000. lcg-double is off by the second state (377401600 against 377401575 from seed 1): the first product, about 1.2·1018, is already past 253 ≈ 9·1015. So 2 states and a millisecond catch what took 400,000 walks and a 1.7% shift to show up. It exits 0 on a pass.

repro.mjs (node, no dependencies: node repro.mjs [N] [seeds], about 4 s) · output