Constraint involving queues and arrays

In reply to kernalmode1:
What you want is to pick elements of a list, and its the index into the list that needs to be unique. You can extrapolate this to get your three q’s.

module test();
 
class temp;
   int array[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,8};
   rand int idx[15];
   rand int q[15];
   
   constraint c1 {
      foreach (q[i]) {
	 idx[i] inside {[0:14]};
	 q[i] == array[idx[i]];
      }
      unique {idx};
   }
endclass
   initial
     begin
	static temp t = new();
	assert(t.randomize());
	$display ("%p\n %p ", t.idx, t.q);
	$finish;
     end
   
endmodule