Random List

Can anyone help with a random list question. I am looking for a solution that uses the random function but eliminates the duplication of values next to one another. In the (green) panel the solution at items 4, 5, 10, 11, 17 & 18 have the same value as the one next to it.

I would like a different value at each occurrence. Is this possible?

Thanks in advance for any help.


random list.gh (7.9 KB)

I don’t think you can do this without scripting.

check if this helps:

1 Like

Works perfect! thank you kindly IVELIN PEYCHEV

IVELIN, is there a way to change the seed ?

You can put this all in another for j in range() where your seed will be β€œj” instead of β€œi”.

Play around a bit.

you can make the seed also defined by a random function :smiley: crazy. But why do you need such a complex solution?

This can be done without scripting by using Delete Consecutive - just generate more random values than you need, delete consecutive, and then grab the right number as a sublist afterwards.

2 Likes

the values will represent extrusion heights and i wanted to explore an option where there was no repeat-ability.

1 Like

Andrew,

this looks great, thank you - i have tried to input the float numbers (as shown in the panel on my original message) into the range of the random function and then tried a list item coming out of the subset function but i am still getting consecutive numbers. what am i doing wrong?

Try making the function in the output of list length x-1 instead of x*1. You are getting both 0s and 5s in your random list, which will both return 0.5 (because indices wrap by default)

that worked great, thank you for the help

1 Like