Array node
Array Shuffle
Randomize array element order. Seed 0 produces a new random order each time Trigger fires. Seed > 0 produces a deterministic (repeatable) shuffle for that seed value.
Inputs
| Port | Type | Default |
|---|---|---|
| ArrayThe list to randomize. Cable any array here; an empty one gives an empty result. | any | — |
| SeedMakes the shuffle repeatable. 0 gives a new random order on every trigger; any value above 0 always produces the same order, and changing it reshuffles. | int | 0 |
| TriggerReshuffles on the rising edge — the order then holds steady until the next edge. A changed list length also forces a fresh shuffle. | bool | 1 |
Outputs
| Port | Type |
|---|---|
| Result | any |
| Count | int |
How It Works
Array Shuffle randomly reorders the elements in the array using the Fisher-Yates algorithm.
- Seed = 0: Truly random — a new order each time Trigger fires.
- Seed > 0: Deterministic — the same seed always produces the same shuffle, which is useful for reproducible results.
The shuffle only occurs when Trigger transitions to true. Between triggers, the shuffled result is held.
Use Cases
- Random selection: Shuffle an array of options and take the first N for a random subset.
- Generative art: Randomly reorder color palettes or position arrays for unique visual patterns.
- Experimental design: Randomize trial order for scientific experiments with reproducible seeds.
Tips
- For picking random elements without shuffling the whole array, use Array Sample with Random N mode.
- The Fisher-Yates algorithm ensures uniform randomness — every permutation is equally likely.
- Connect a Timer's Done output to Trigger for periodic re-shuffling.
Open Array Shuffle in the interactive catalog →
Array Shuffle is one of 381 nodes in Grafit Pro.
Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.