alteryx Community

# Alteryx Designer Discussions

SOLVED

## How do I generate 10 unique random numbers between 1 and 100 that sum up to 100?

11 - Bolide

How do I generate 10 unique random numbers between 1 and 100 that sum up to 100?

Example:

 11 23 3 5 18 6 7 8 9 10

–––––––––

100

––––––––––

11 REPLIES 11
20 - Arcturus

This is a great challenge.

Let me see how this can be solved.

11 - Bolide

Hi @gnans19

This is what I came up with:

basically it calls and number between 0-100 and then sums up and takes the % of the total to give a split between 0 - 100.

Let me know if this works.

Alteryx

I hope this helps !!

Thanks

Nitin

20 - Arcturus

Hi @paulfound and @nitinsnow  ,

Great solutions. I did a couple of runs.

It seems like it isnt giving unique numbers each time. And is there a way to make it that it doesnt give me 0 as a number.

Cheers and Happy Analyzing : )

Alteryx

The workflow generates random numbers at each run (with the addition of 100), and now the numbers are always greater than 0.

I hope this helps, if yes, please accept it as a solution.

Thanks

Nitin

20 - Arcturus

Hi @nitinsnow ,

As per the requirement. The number needs to be unique. Its still not unique.

11 - Bolide

Getting a bit messy now, but updated to get 10 unique numbers that adds up to 100.

11 - Bolide

Just realised there is a chance that these won't be unique.

Alteryx

@atcodedog05 We are generating a random number here, At each run, the number change, so the column might have few duplicate values for a specific run.

Labels