In reply to verif_guy12:
It would help to show differences in results between what you are expecting and what you are seeing.
One problem is you may have is doing integer division. You need to scale the numbers up.
class try;
rand int A, B;
constraint value_range {
A inside {[0:200]};
B inside {[1:200]}; } // prevent divide by 0
constraint ratio_constraint {
A*1000/ B inside {1000, 3000}; }
endclass
module mod ();
initial repeat (20) begin
static try obj = new;
assert(obj.randomize());
$display("A = %0d, B = %0d", obj.A, obj.B);
end
endmodule