alteryx Community

# Alteryx Designer Desktop Discussions

SOLVED

## Random List Without Repeats

7 - Meteor

I am attempting to assign teams together in a schedule. I need the first Column to randomly assign to the second. I have tried several methods but I keep getting repeated names.  I would be willing to settle for the first column just doing a rotation, but am also unable to find this answer as well. Any help would be greatly appreciated.

4 REPLIES 4
17 - Castor

@TJ1

In the Math functions found in the Formula tool, there is a "RandInt(" function that will return a random integer. Sort by this randomly assigned integer, then a Join tool can perform a position-based join to pair up the two lists.

Example solution attached.

8 - Asteroid

Hi!  Interesting problem.  I may have found a way to do this by separating the name columns into 2 separate streams, assigning each record in each stream a random integer (with the 'RandInt()' formula), sorting each stream by that number, and then joining the records back by record position (don't join on any field, just lump them together after the sort).  In the example below I set the RandInt function to choose an integer between 0 and 10000, and then by sorting on that number and joining on record position, I don't need to worry about the pairs needing to receive the same random number.  Setting the RandInt parameter to a higher value than the number of pairs I need to create just lowers the possibility that 2 records in the same column will get the same random number, which I think would force sort by alphabetical next, meaning you may not get as much variety as hoped for.

A snapshot of my workflow is below.  I just created 2 lists like yours with 6 names each for this example.

7 - Meteor

Thanks a lot this really helped.

@CharlieS wrote:

@TJ1

In the Math functions found in the Formula tool, there is a "RandInt(" function that will return a random integer. Sort by this randomly assigned integer, then a Join tool can perform a position-based join to pair up the two lists.

Example solution attached.

7 - Meteor

Thank you very much for the time you put into this. This helped a lot.

@mandycgray wrote:

Hi!  Interesting problem.  I may have found a way to do this by separating the name columns into 2 separate streams, assigning each record in each stream a random integer (with the 'RandInt()' formula), sorting each stream by that number, and then joining the records back by record position (don't join on any field, just lump them together after the sort).  In the example below I set the RandInt function to choose an integer between 0 and 10000, and then by sorting on that number and joining on record position, I don't need to worry about the pairs needing to receive the same random number.  Setting the RandInt parameter to a higher value than the number of pairs I need to create just lowers the possibility that 2 records in the same column will get the same random number, which I think would force sort by alphabetical next, meaning you may not get as much variety as hoped for.

A snapshot of my workflow is below.  I just created 2 lists like yours with 6 names each for this example.

@mandycgray
Labels