Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

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

gnans19
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
atcodedog05
22 - Nova
22 - Nova

This is a great challenge.

 

Let me see how this can be solved.

paulfound
11 - Bolide

Hi @gnans19 

 

This is what I came up with:

 

PaulFound_0-1600237136505.png

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.

 

 

nitinsnow
Alteryx Alumni (Retired)

I hope this helps !!

 

Thanks

Nitin

atcodedog05
22 - Nova
22 - Nova

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 : )

nitinsnow
Alteryx Alumni (Retired)

Hi @gnans19 @atcodedog05 

 

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

 

atcodedog05
22 - Nova
22 - Nova

Hi @nitinsnow ,

 

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

paulfound
11 - Bolide

Hi @atcodedog05 , @gnans19 , @nitinsnow 

 

PaulFound_0-1600242924352.png

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

 

 

paulfound
11 - Bolide

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

nitinsnow
Alteryx Alumni (Retired)

@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