SV Constraint using array of weights

Hi all,
Is there a cleaner way to code it to make it more general rather than hard coding it.
var can have values between 0-95 but rate at which we see a random value from 0-31, 32-63, and 64-95 is decided by weight array in following manner:
weight_arr = '{2,3,4};
constraint rate_c
var dist{[0:31]:/weight_arr[0],[32:63]:/weight_arr[1],[64:95]:/weight_arr[2]};

Problem is that range might increase in future, so I don’t want it to hard-code it.


In reply to navjeet1503:

Two ideas that might help:

Thanks Dave.