How do I disable pre_randomize function that gets called by default for a particular instance of class when I do class_h.randomize()? other class handles can call randomize and then call pre_randomize function by default and execute but not for this specific handle. is extending and overriding pre_randomize the only possible solution? other solution would be: std::randomize(c1_h.r1) with {c1_h.r1 == 3;};
module m1;
class c1;
rand int r1;
int r2;
constraint c1_c{(r2!=0) -> r1 == r2;}
function void pre_randomize();
r2 = 'd2;
endfunction
endclass
initial begin
c1 c1_h = new();
c1 c11_h = new();
c1_h.randomize();//how to disable pre_randomize to this handle only
c11_h.randomize();
$display("r1 is %0d", c1_h.r1);
$display("r1 is %0d", c11_h.r1);
end
endmodule