Does randc loses cyclic random nature for multidimensioal randc arrays?

In reply to suyog_asic:

Randc can’t be used in that way for array to get unique elements.
LRM said:


Arrays can be declared rand or randc, in which case all of their member elements are treated as rand or randc.

You should use rand with unique constraint (move the randomize statement outside of the loop):


module rand1;
class expt;
rand bit [3:0] a[0:7];
  constraint c_unique{
    unique{a};
  }
endclass

initial begin
  expt e1 = new();
  e1.randomize();
  foreach(e1.a[i]) begin	
    $display("a[%0d] = %0d",i ,e1.a[i]);
  end
end
endmodule

Noted: unique constraint is very expensive, it is difficult to be solved. SV will take very long time to solve unique constraint for big array size.