Help with constraints involving array

Hi,
I was thinking of writing constraint in an efficient manner, but could not get one .
Problem statement is -
I have a q type , suppose input_array[int][$] . This is initialised for some values like
input_array[50][0] = 30 , input_array[50][1] = 25 , input_array[27][0] = 10 , input_array[27][1] = 11
I want to randomize another array output_array[int] such that —

  1. output_array first index should take every value of input_array first index .
  2. output_array[50].size = 2 * input_array[50].size … for every first index .
  3. fill values in output_array[50] such that every value of input_array[50] occurs 2 times in any order . …for every first index.

In reply to ashish_banga:

You cannot use constraints to size an associative array. Although I think it’s possible to write a constraint for your third requirement, it sure is a lot simpler to do everything in pre_randomize.

function void pre_randomize();
  output_array.delete();
  foreach (input_array[index]) begin
     output_array[index]={};
     for(int i=0;i<input_array[index].size;i++)
        repeat(2) output_array[index].push_back(input_array[index][i]);
     output_array[index].shuffle();
  end
endfunction