This is quite a hard problem to solve using constraints. A better approach is creating a ordered deck of cards, then shuffling them. (See Randomize deck of cards using constraints)
A problem with your approach is you are using the sum()
method without referencing any iterated items. Another problem is you have to link the chosen suits with their ranks preventing duplicates.
Here is a different approach
module top;
typedef struct packed {
int suit;
int rank;
} TCard;
class TFoo;
rand TCard cards[52];
constraint c1 {
foreach(cards[i]) {
cards[i].suit inside { [0:3] };
cards[i].rank inside { [1:13] };
}
unique { cards };
}
endclass
TFoo f = new;
int status;
initial repeat(10)
begin
assert(f.randomize());
$display("%p",f.cards);
end
endmodule