3*3 matrix : SV constraint to make right diagonal elements zero

Right Diagonal elements are zero’s in a 3*3 matrix
Just for an example:

1 2 0
3 0 4
0 5 6

This is the below SV constraint that I have written, got the expected output;

module m1;
  class c1;
    rand bit [3:0] array[3][3];
    constraint c1{
      foreach (array[a,b])
      {
        foreach (array[a]){
          if (
            (a==0 && b==2) ||
            (a==1 && b==1) ||
            (a==2 && b==0)
          )
          array[a][b] == 0;
      	else
      		array[a][b] !=0;
        }
      }
    }
    function void post_randomize();
      $display("elements %0p", array);
      $display("dimension %0d", $dimensions(array));
    endfunction
  endclass
  c1 obj;
  initial begin
    obj = new;
    repeat (1) begin
      obj.randomize;
    end
  end
endmodule

================
Query : The above constraint looks like very directed way, like

first row, last column
second row, mid column
third row, first column

I was looking for generic way or any generic constraint other than this solution.
Any other alternative way, please suggest.

Thank You,

In reply to Mahesh K:

module m1;
  class c1;
    rand bit [3:0] array[5][5];
    constraint c1{
      foreach (array[a,b])
        if (a == $size(array)-b-1)
          array[a][b] == '0;
        else
          array[a][b] != '0;
    }
    function void post_randomize();
      $display("elements %0p", array);
      $display("dimension %0d", $dimensions(array));
    endfunction
  endclass
  c1 obj;
  initial begin
    obj = new;
    repeat (1) begin
      assert(obj.randomize);
    end
  end
endmodule

In reply to dave_59:

Hi Dave,

What is the difference between these two 0 assignment statements:
(1) array[a][b] == '0;
(2) array[a][b] == 0;

In reply to Michael54:

'0 is an unsigned fill literal whose width is context determined. In case (1), '0 is the same as 4’b0

0 is a signed 32-bit decimal literal. In case (2), array[a][b] will be extended to 32 bits.

In reply to dave_59:

Thanks Dave :)