Draw a random unique list of rows

Hey!

I’m searching for a solution to randomly draw rows from a table that has duplicate entries. The important part here is that the end result needs to be a list with unique entries.
It is comparable to a prize draw situation where you have following situation

  1. Anna
  2. Jack
  3. Jack
  4. Timo
    5.Joseph
  5. Lana
  6. Lana

These “participants” are in the pot - I want to draw 3 “winner” but each participant can only win one price max. I still want to have the ones with more entries to have a higher chance to be drawn so I can’t just eliminate them with the duplicate row filter.
Does anyone have a solution for this?

Kind regards

Hello @Chaosprinzip,

this was interesting! I used recursive loop and Random Label Assigner (Data) node to achieve it. Hope I got it right. Here is workflow to check:

Give it a try and in case of any questions feel free to ask.

Br,
Ivan

1 Like

Thanks! I will check it a bit later on and let you know :slight_smile:

I would use simpler approach.
Use Random number assigner with min = 1 and max = number of participants
Sort result by random number assigned.
Use Group by to get rid of duplicates
Filter top 3.

4 Likes

That’s a very good idea! Will check this option as well :slight_smile: Thanks!

Hello,

now that I think of it Shuffle followed by @izaychik63 approach does the trick as well :smiley:

Br,
Ivan

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.