Array node

Array Sample

Pick a subset from an array: every Nth element, random N elements, first N, or last N. Provides flexible downsampling and selection with optional deterministic seeding.

Inputs

PortTypeDefault
ArrayThe list to thin out. Cable any array here; an empty one gives an empty result.any—
ModeHow the subset is picked: every Nth element, N random ones, the first N, or the last N. Values outside the list fall back to every Nth.int0
NThe step size in every Nth mode, or how many elements to keep in the other modes. Values below 1 are treated as 1, and asking for more than the list holds simply keeps all of it.int2
SeedMakes random picking repeatable. 0 rolls fresh every frame; any value above 0 always returns the same selection for the same list.int0

Outputs

PortType
Resultany
Countint

How It Works

Array Sample extracts a subset of elements using the selected Mode:

  • 0 — Every Nth: Takes every Nth element (N=2 takes every other element, N=3 takes every third, etc.).
  • 1 — Random N: Picks N random elements. Seed=0 for random, Seed>0 for deterministic.
  • 2 — First N: Takes the first N elements.
  • 3 — Last N: Takes the last N elements.

Use Cases

  • Downsampling: Reduce a high-resolution array to fewer points for display (every Nth).
  • Random selection: Pick N random samples from a dataset for testing or display.
  • Preview: Show just the first or last N elements of a large array.
  • Decimation: Reduce EEG data from 16kHz to a lower rate by taking every Nth sample.

Tips

  • Every Nth mode with N=1 returns the entire array (every element).
  • Random N with Seed>0 gives the same selection each time — useful for reproducible experiments.
  • For extracting a contiguous range rather than scattered samples, use Array Slice.

Open Array Sample in the interactive catalog →

Array Sample 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.

More Array nodes