Verification #24 · 2026-10-17 · Nested objects · Easy · about 10 min

The header that never changes

A packet owns a header (kind and prio) and a payload length len. One call to p.randomize() must produce a whole new packet:

  • hdr.kind and hdr.prio are new random values each time, and the header's own constraints hold (prio <= 11).
  • len is 1 to 64, and a control packet (hdr.kind == 0) has len <= 4.
  • A test can steer any of it inline, and the solver finds values that fit together: p.randomize() with { hdr.kind == 2; len > 32; }, or with { len > 4; }.

Run randomizes one packet eight times, then asks for a long packet of kind 2. Fix packet.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.