In reply to jyoveda:
class A;
int lut[7][] = '{
0: {0,1,2},
1: {3,4},
2: {5},
3: {6,7,8,9},
4: {10,11},
5: {12,13},
6: {14,15}
};
rand int n;
rand int elements[];
constraint c {
n inside {[1:$size(lut)]};
elements.size == n;
foreach(elements[i]) {
i>0 -> {
elements[i] > elements[i-1]; // ascending order
elements[i] - elements[i-1] <5; // difference between adjacent elements is less than 5
}
elements[i] inside {lut};
}
foreach(lut[i]) // at most one element from each lut row
lut[i].sum() with (int'(item inside {elements})) <=1;
}
endclass
module top;
A a = new;
initial repeat(10) begin
assert(a.randomize());
$display("%p",a);
end
endmodule