Report this content
We want the Dreams coMmunity to be a safe, diverse and tolerant place for everyone, no matter their age, gender, race, sexual orientation or otherwise. If you believe this content to contradict these principles, you can file a report for our coMmunity teams to investigate.
Note that misuse of the reporting tool will not be tolerated.Item being reported:
I'm actually working on implementing a standard deck of cards, and finished the logic to generate a random number and interpret that as a specific card, I can upload that in a few hours.
My solution is to generate a random number using a signal generator, use math to turn that number into a card (4 Suits, 13 Ranks). Then, I check if that card has already been generated. If it hasn't, I output that card. Otherwise I generate another number.
But this is a pretty open ended design question and my solution isn't the only one. You could also simulate a stack (the data structure kind) of all the cards, assign them a random order, and pop through that stack in order.
I personally think this is a great exercise for getting your mind around how to design systems in Dreams.