Tree Shuffler

Shuffles items from a pool into an existing tree structure

Data Nickname: T-Shuffle

Overview

Shuffles items from a pool into an existing tree structure

Inputs (3)

  • Tree (Generic): Existing tree structure
  • Choices (Generic): List of choices to shuffle from
  • Seed (Integer): Random seed

Outputs (1)

  • Result (Generic): Shuffled result

Method, assumptions and simplifications

The same notes appear in the component's Info output.

Method

  1. Shuffles the Choices list once with a Fisher-Yates shuffle seeded by Seed (default 42).
  2. Walks the Tree branch by branch and replaces each item with the next item of the shuffled list, cycling back to the start when the list runs out. The output keeps the tree's paths and branch lengths.

Assumptions

  • Only the structure of Tree matters; its item values are ignored.

Simplifications and limits

  • Not independent random draws: when the tree has more items than Choices, the same shuffled sequence repeats, so every choice appears evenly.

Workflow

  • Grid cells or panel tree -> Tree; material or colour options -> Choices.

References

  • Knuth D.E., The Art of Computer Programming, Vol. 2: Fisher-Yates shuffle.