Shuffle sublist in different sequences

Hi,

I’m trying to create a facade panel and I want to shuffle the values of the sublists in difference sequences (if possible through a slider node).

For example:

Sublist 0: 210, 120, 190, 110, 180,190
Sublist 1: 120, 190, 190, 210, 180, 110
Sublist 2: 190, 190, 110, 180, 280, 120

etc etc

I’ve tried to look for a solution but I can’t find anything to solve this.

image

List.Shuffle should have longest lacing. You’re shuffling the lists of lists at the moment not the contents of the lists of lists.

Hi Jacob,

I already tried that but the same thing happens. All the “shuffeld” sublists still have the same sequence

That’s just an annoying part of how the shuffle node works. You’ll have to create your own randomizing function.
You can try something like this:

4 Likes

Also works with this Python code:

# Enable Python support and load DesignScript library
import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")

import random

# The inputs to this node will be stored as a list in the IN variables.
x=IN[0]

# Place your code below this line
random.shuffle(x)
for sublist in x:
     random.shuffle(sublist)

# Assign your output to the OUT variable.
OUT = x