Hi all,
I am trying to randomize the elements of an array, under the condition that similar elements will not be placed one after the other in the shuffled output.
For example, the original array would look like this:
{‘A1’, ‘A2’, ‘A3’, ‘B1’, ‘B2’, ‘B3’}
And the shuffled version should not have, say, ‘A1’ and ‘B1’ being successive when being read. Therefore the condition would be that elements that share the same ending should not be successive.
So an acceptable output would be:
{‘B1’, ‘B3’, ‘A1’, ‘B2’, ‘A3’, ‘A2’}
I could create a for loop that checks whether the output is correct, and re-shuffle if not, but it could be that this manoeuvre would take some time if the shuffling keeps producing incorrect outputs.
So far I did not find a workaround this in the blueprint, and suspect I’d have to modify the Shuffle function. Has anyone encountered this before? Did you find a way to solve it in the Blueprint?
Thanks a lot for your help!
Best,
Eva