How to get a non-duplicate randomized value from coverage?

In reply to UVM_LOVE:



...
...
...
CROSS: cross img_idx, crop_seed;

endgroup
  
  function new();
       img_src = new();
    endfunction
endclass
 
module constr_dist;

  initial begin
    packet pkt;
    pkt = new();
    
    $display("------------------------------------");
   
    while(pkt.img_src.img_idx.get_inst_coverage() != 100) begin
    //while(pkt.img_src.get_inst_coverage() != 100) begin
      pkt.randomize();
      pkt.img_src.sample();
      $display("\const_img_index = %0d",pkt.img_index);
    end
    
    $display("------------------------------------");
 
  end
 
 
endmodule