Systemverilog constraint on a enum type

In reply to aksistla:

The constraint on subset is assigning non integral values to integral property.

constraint subset_c {foreach(subset*) subset[i] inside {[0.15 * num_fruits[i] : 0.75 * num_fruits[i]]}; }

Lets say for example num_fruits[i]=10. Then value of subset[i] is to be inside 1.5 to 7.5. This is not acceptable.

According to SystemVerilog LRM 1800-2012 , Section 18.5.3, the constraint solver can solve integral type constraints:

The solver can randomize singular variables of any integral type.
Constraints can be any SystemVerilog expression with variables and constants of integral type (e.g.,
bit, reg, logic, integer, enum, packed struct).
Constraints support integer value sets and the set membership operator

You can use [i]post_randomize* function to set the values in subset variable. After removing the subset constraint, I am seeing proper randomization happening using VCS.

//Output: (subset is signed)
banana : 10 : 1193078623
strawberry : 10 : -1364192802
pineapple : 10 : -505257340
apple : 10 : 2045249375