Generate unique elements in an array

In reply to ssingh:

Looking at your original question, you can simply use the array shuffle method if all you want is a random ordering of an exhaustive set of values in an array;

class A;
bit [3:0] data[16]; // do not declare rand
rand int other_data;
function void pre_randomize;
  data.shuffle();
endfunction
function new;
  for(int i=0;i<data.size();i++) data[i]=i;
endfunction
endclass

Now a call to a_h.randomize() will give you a random shuffling of the array.

I don’t understand your last question. Can you give an example with all the data declarations and show what you would like to see as the set of values that randomize() should generate?