I'm no expert at Construct but I would have done something along the line of this (it picks cards at random instead of assigning a random value and is flexible since you can place any equal number of cards in the layout, not only 20):
#Global values, ho!
Global number cardIDs = 1
Global number cardCount = 0
#Count the number of cards and store in global value
On start of layout
- set cardCount to number of cards in the layout (card.Count)
#Assign the IDs to cards that don't have one (ID = 0) at random
cardCount > 0
card ID = 0
Pick a random card instance
- Set (card) ID to cardIDs
- Subtract 1 from cardCount
- Add 1 to cardIDs
#This resets the ID enumerator halfway through assigning
cardIDs = (card.Count/2)+1