Randomize deck of cards using constraints

In reply to dave_59:

In reply to bharat_vg:
It would be far easier to generate a deck of 52 cards in order, then use the built-in cards.shuffle() method.
Much harder would be to make sure each card is unique using a nested foreach loop

constraint C_unique { foreach (cards[ii]) foreach (cards[jj]) 
ii != jj -> cards[ii].suit != cards[jj].suit && cards[ii].rank != cards[jj].rank; }

I do not think you need to be concerned with the color as that will naturally fall out with the suit constraint.

Is there a way to use the built in “unique” constraints after defining the card characteristics to simplify and avoid using a foreach loop? If we have a 16bit variable (numeric) using unique after defining the size would ensure that the values for each element are unique (followed by shuffle if we generate in order).

Just trying to think if we there is a way to simplify the problem here using that thought process.