*rand help, or randomness in general

So, I built a card machine a while back that relied on using extracted letters from a string that represented the deck. So I had a key with something like “A”= Ace of spades, “B”=2 of spades, “N”= Ace of clubs, “a”= Ace of diamonds, etc., and a string that was “ABCDEFGHIJKL[…]XYZabcdef[…]xyz”, which I then shuffled by splitting into two different variables, then compiled together using a weight draw to randomly pick from each of them. I could then read off that by using hand#1, to extract the letter and tell me what the card was via a subroutine.

Of course, with the inclusion of the major arcana, and the minor arcana being 56 rather than 52, you’re probably going to have to use a grouped system where three parts of the string in a row would represent a single card.

(Of course, in practice, I’d recommend you just dispense with the idea of having an arbitrary read, and instead lock it to either one, or maybe a couple, tailored to the needs of the story.)

2 Likes