Array randomization

In reply to dave_59:

In reply to mlsxdx:

class C;
rand int A[9];
rand int max;
constraint c_max { max inside {[1:9]};}
constraint c_1 { foreach(A[i]) A[i] inside {[0:max]};}
constraint c_2 {A.sum(item) with (int'(item == max)) == 1;}
endclass

Hello Dave,

Can A.max() system function be used in the constraint ? I see an error saying array equality feature is not yet supported. I am thinking of something like this.

class uniquemax; 
  rand int unsigned a[9];
  rand int q[$];
  constraint a_c { 
    foreach(a[i]) 
      a[i] inside {[0:9]}; 
    q.size()==1;
    q[1]==8;
    a.max()==q;
  //  a.sum() with (int'(item==a.max()))==1;
  }

Thanks