Random lists of numbers from a data pool

Been playing with this for a while…
I want to generate “n” lists of numbers from a pool of numbers. Forgive my math ineloquency…
Simple example…
Number pool: a,b
Wanted list: a,b,x [where x is either a or b]

…then shuffle all the lists in order to get something like:
a,a,b
a,b,a
b,a,a
b,b,a
b,a,b

I have this:

Only problem with this one is that I always have exact same distribution of “a” and “b” values as x, and i want that to be “random”. Idea is not to have all same members in a list.
Anyone with more elegant solution? I accept scripting solution :smiley:

Would have happily provided a solution but you didn’t post your code. You need to use a series of random integers (0…100) as seed values, so each branch gets a unique random seed.

Here’s the code. Sory…
q1.gh (13.1 KB)

q1_2018Apr11a
q1_2018Apr11a.gh (11.3 KB)

I may have missed a detail… In retrospect, it appears that you want to guarantee that each branch contains at least one of each of the values in the “data pool” (‘Value List’ panel in my code)? Version ‘a’ doesn’t do that…

Version ‘b’ (below) does:


q1_2018Apr11b.gh (11.1 KB)

2 Likes