The distribution is geometric
# grade this stage (from your course directory)
npx theinference test --stage verify-the-distribution --watchA quick structural smoke test before any graph exists. Over the full insertion order, count how many elements reach each layer and confirm the counts match the seeded draw exactly. layerCounts[l] = number of elements whose drawn level is ≥ l.
With M = 8 you should see a clean geometric staircase: every element on layer 0, roughly an eighth of them on layer 1, an eighth of those on layer 2, and so on, down to one or two at the apex.
What to build
Print per-layer node counts
Implement layerCounts(levels) and wire the structure subcommand in src/cli.ts. It reads the data file, draws all levels with the seed, and prints one JSON line:
{ "layers": <count>, "counts": { "l0": ..., "l1": ... }, "top": <topLayer> }
./your_program.sh structure <fixture>/chapters/01-data-structures/steps/06-verify-the-distribution/fixtures/data.json
These counts are not a sample you tolerance-check — they come straight from the deterministic seeded draws (the exact level array from the previous step). So they must equal the reference integer-exact (same seed, same mulberry32, same insertion order). A ±5% band here would only mask a wrong PRNG. (The ±5% idea belongs to the post-build structural check in Chapter 4, where edge-shrinking can legitimately nudge a count — not to this pure level-draw histogram.)
Process mode: stdout_json_match of your printed object against the frozen reference, atol 0 — a deep, exact compare of every per-layer count.