Hardware interview practice
Pick a weighted random enum
Return LOW, MED, or HIGH randomly with weights 1:2:3.
Reviewed example
Work through one case
Input
draw one uniformly random integer with $urandom_range(6,1); map 1->LOW, 2..3->MED, 4..6->HIGHExpected output
One valid draw: 4, producing HIGHThe six equiprobable outcomes allocate one slot to LOW, two to MED, and three to HIGH, giving a 1:2:3 weighting. Any individual draw is non-unique.
What to cover
Requirements
- Map six equally likely integer outcomes.
- Give LOW one outcome, MED two, and HIGH three.
