Rand behaviour using randc

In reply to ABD_91:

Please find the working code below

module top;
  class c1;
    randc bit [2:0] addr;
    function void post_randomize();
      $display("unique value %0d",addr);
    endfunction
  endclass
  c1 obj;
  initial begin
    obj = new;
    repeat (9) begin
    void'(obj.randomize());
    end
  end
endmodule

I’m constructing the object once. Afterwards I’m iterating the randomization.