2D array constraint randomization

In reply to dave_59:

Hi dave ,
Thanks for the solution. But I have doubts regarding col-sum.


 a.sum() with (int'(a[item.index][i]))== 10; // cols a[0][i] + a[1][i] 

-How is it working? what does item.index mean?

And what about diagonals? If I want to put constraints on the sum of values of diagonals How should I write the code?