Would it be better to set up the card deck as a sprite with its cards imported as Animation Frames, instead?
It does not really matter. If you want to animate your cards at some point, the solution with different animations is better. If you don't need animations, then using frames might be a tad easier.
The while loop and there especially how the i is set up and how it uses global variables make me cringe a bit. So I use code with a for loop instead that's less error prone and imo easier to grasp, because everything is at one place in my example (also it is a function as it should be, since you want the shuffling to be reusable):
What should interest you the most is probably the event that creates the cards and sets the animations.
For example you could write (with your names mentioned up top):
Problem: if you want to fill in the CardName with an actual card name, this won't work anymore.
In that case you will need a dictionary or another array, where you store the name, which then you can let C2 read, when it's time to set the animation.
I'm not sure what kind of properties your cards will end up with. There is also the possibility to just fill an array with all the information, each card has its own x, and then y = 0 would be card name, y = 1 would be animation name and so on. You can read in stuff like this even from a csv file. Just be aware that importing the data from csv will import numbers as string, if you don't explicitly convert them upon adding them to the array.