Constraint for a random variables

In reply to n347:

Nothing to add other than thanks for both the example and solution. Reading the original question, I thought “Homework / Interview Question”. Which is ok - I like puzzles - I brainstormed various solutions.

But the super compact solution @n347 posted, was just… really neat. I still have a lot to learn about the strength and abilities of the SystemVerilog constraint solver.

From reading these forums, I know there’s certainly potholes to watch out for. But this is a powerful tool.