A brief followup: v1.20 slightly modified the behavior of "range", requiring an adjustment to the above script:
When looking up a card by index, instead of
deck.cards[(range deck.cards)[index]]
The "range" operator can now be used more directly:
(range deck.cards)[index]