Help with allocating random items not previously selected

Hi Folks,

I’m stuck with something. I hope someone can help.

Basically, I’m trying to simulate dealing cards to players in a card game. The way I do this is

  1. to have a data type of Cards called SessionDecks which has the card name, a yes/no field to show when a card has been dealt and a ‘player’ field to show which player the card has been allocated to.

  2. Schedule an API Workflow on a list:


  1. Within the backend workflow, I’ve set up this endpoint. It does a search for cards that have NOT been already dealt and allocates a random item to each player. It runs twice to deal two cards to each player.

It usually works, but about 50% of the time, it will allocate only one card to a player. Looking at the log, I can see that what’s happening is that a card is allocated to one player and then a later instance of the workflow allocates the same card to a different player. It seems to ignore the fact that that card has ‘dealt’ indicator set against it.

Does anyone have any ideas on how to make this work more reliably?

Also happy for suggestions on how to achieve this differently.

Any help would be very gratefully received.

Has anyone got any ideas on this?

I’m really stuck.

This topic was automatically closed after 70 days. New replies are no longer allowed.