DescriptionQ695
Q695DVASIC interview problem
Pick a weighted random enum
TechniquesRandomizationProbability
DifficultyEasy
TopicConstraints
LanguageSystemVerilog
Requirements2 checkpoints
01
Problem
Return LOW, MED, or HIGH randomly with weights 1:2:3.
Example input and output
Use this case to check your interpretationInput
draw one uniformly random integer with $urandom_range(6,1); map 1->LOW, 2..3->MED, 4..6->HIGHOutput
One valid draw: 4, producing HIGHExplanation
The 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.
02
Requirements (2)
- Map six equally likely integer outcomes.
- Give LOW one outcome, MED two, and HIGH three.
