Verification #40 · 2026-11-02 · Distributions · Easy · about 10 min
Weighted burst lengths
burst is a bus burst with a random length len of 1 to 16 beats. The lengths are weighted:
- 50% of bursts are a single beat.
- 10% are the maximum, 16 beats.
- The other 40% are spread evenly over the lengths 2 to 15.
randomize() works and every length is in range, but single-beat bursts are rare and most of the traffic is long. Fix burst.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.