In reply to sfenil1804:
Could you please explain whats happening in the two foreach loops ? why do we need the condition !(a==i && b==j) ? is the first foreach loop creating a randomized matrix and the second matrix trying to make the elements unique by iterating the first one ?
constraint unique_elements {foreach (array[i][j]) {
foreach (array[a][b]){
(!(a==i && b==j)) -> array[a][b] != array [i][j];
}
}}