Randomly combination of values from two lists using Python and Dynamo

A successful day and again a small step further to a room optimization workflow.

The goal was it to combine two values out of two lists randomly. The first list includes CO2 impact values regarding wall construction materials, and the second list regarding floor materials (CO2 kg eq / m2 material). The values I have should be combined randomly, eg [LstWall x10, LstFloor x2]; [LstWall x51, LstFloo x23], hence the approach here:

1 Defining the lists as Input

ListWall = IN[0]
ListFloor = IN[1]

2. Creating first all possible pair variations

pairs = [(w,f) for w in ListWall for f in ListFloor]

3 Picking randomly pairs

choice = [random.choice(pairs) for _ in range (50)]

Actually very easy if you see it like this .. but yet took me a few days to figure it out 🙂

Keep you posted.

Cheers Jules