Doesn’t what you have work for you ? The below seems to work fine for me:
module test();
int a ;
int b[$] = {1,2,3,4,5};
int c[$] = {6,7,8,9,10};
initial begin
std::randomize(a) with {
{ a inside {b} || a inside {c} };
};
$display("a is %0d",a);
end
endmodule
In reply to zz8318:
you should use the following constraint for m_ele can pick value from the either of the array.
You can also add the distribution, based on your requirements.