Cards (52 Playing Cards)
Game (Community Cards) in the Community Cards(list) I’m trying to grab 3 items from the Card database, but I’m kinda stuck on how to get it to work, i either need to put item from 1 until 3 (sorted) but still the same 3 cards showing up, I’m totally stuck on how to make it random.
In summery: I wanna take 3 things from database (totally) random and put them in a list of things.
Hey there, the cards have been stored in the database under “Cards” with 52 items.
I’m trying to make changes to a list.
That list is “Community Cards”
So in the workflow:
Community Cards add list Search for Cards:from item 1 until 3, but those are always the same cards.
My work around for this at this moment is going from “add list” to just "
CommunityCards “add” search for cards:random item..
But that leaves me with needing to press the button 3 times
for the cards to show up.
Thanks for answering, can grab some screenshots when I get back home.
Hey there, the cards have been stored in the database under “Cards” with 52 items.
I’m trying to make changes to a list.
That list is “Community Cards”
So in the workflow:
Community Cards add list Search for Cards:from item 1 until 3, but those are always the same cards.
My work around for this at this moment is going from “add list” to just "
CommunityCards “add” search for cards:random item..
But that leaves me with needing to press the button 3 times
for the cards to show up.
Thanks for answering, can grab some screenshots when I get back home.
So firstly I would store the cards as option set rather than DB as cards are always going to be these 52 only i.e. static. So no point storing them in DB. It will also save WUs for you and make app faster in this case. In option set you can give them various attributes like what do they mean and can also assign one numeric attribute from 1-52 to identify which card is it, say you call it index.
Secondly to get random three cards you would need to have some way to get three randomised numbers. There can be many ways of doing that. One of ways that comes to my mind immediately is this.
for randomizing decks I would go ahead and leave them in order in a list which is just a list of numbers 1-52. You can hardcode the value and the suit or make an expression to generate them (using division and mod).
Generate a random number from 1 to listsize and delete that from the list and add it to another list. Do that 3 times and you will have your 3 cards.
when the button is clicked trigger a workflow with 3 steps, each one gets a card and removes it from the deck.
The hard part is always being able to generate a truly random number…
You should run your algorithm hundreds of thousands of times to see if the distribution of numbers is correct.