Random is hard. Knuth is good for random (he's good for lots of other topics, too!) If you have a good random generator, the trick of assigning each card a random weight (0 .. <1) and then sorting by ...
The Linux sort command has an impressive number of ways to sort, from alphanumeric to random. Here's a look at some of the more useful ones. The Linux sort command can arrange command output or file ...