Constraint to generate an array of random numbers where a certain value is repeated fixed number of times

In reply to nachiketag:

class numberGen;
   int i,j;
   rand bit[7:0] arr[100];
   function new();
      i = 5; j =10;
   endfunction
   constraint pick_ij { arr.sum(item) with (int'(item == i)) == j;}
endclass : numberGen