Generating a randomised list of values that do not repeat consecutively

Nothing random about permutations unless you make it so. CrossRef component does that or you can use this little bit of Python:

__author__ = "Joseph Oster"
__version__ = "2021.06.06"

from itertools import permutations  

perm = permutations(vals, len(vals))
perms = []
for c in list(perm): 
    perms.append("+".join(c))

P = perms


permutations_2024Jul15a.gh (10.0 KB)

To randomize, you can jitter the list of permutations and perhaps use a SubSet (Sub List) of them.


permutations_2024Jul15b.gh (11.3 KB)

1 Like