30 bit number with constraints

In reply to Rahulkumar:

Sorry for the confusion.

Consider a number, say rand bit [29:0] var1.

Using constraint, we have to generate a number such that it has 10 1’s (any order any index) in it and at other indices, the values have to be 0.

It is a 30 bit number but not a number b/w 0 to 30.