Random

Generate random numbers from a chosen distribution and seed.

What it does

Random draws from whatever you give it. Wire something with rows into Source and it makes one independent draw per row, handing back as many values as the wire has; leave Source empty and it makes a single draw. Mode sets what a draw means: Uniform (a value in a range), Integer (whole numbers), Walk (drifts from its previous value), Pick (one element of the wired array), Shuffle (reorders that array), or Unique (whole numbers with no repeats).

Bias reshapes the distribution. It is a curve you draw: a straight line is flat, bending it crowds values toward one end of the range, and an S-shape crowds them toward the middle.

Every draw is seeded. The same Seed reproduces the same sequence on a given node.

When to use it

ParameterTypeDefaultWhat it does
modeString"Uniform"Uniform: flat distribution, shaped by Bias. Integer: whole numbers. Pick: random element from the wired array. Shuffle: random permutation of it. Walk: random step from previous. Unique: no-repeat draw (urn model). One of: Uniform, Integer, Pick, Shuffle, Walk, Unique.
timingString"Every Frame"Every Frame: new random each cook. On Trigger: new random only when trigger fires, holds value between. One of: Every Frame, On Trigger.
triggerBoolean or Number—Rising edge generates new random value. Value holds until next trigger.
thresholdNumber0.500Trigger fires when input crosses above this value
minNumber0Minimum output value (inclusive)
maxNumber1Maximum output value (inclusive for Integer, exclusive for Uniform)
output_typeString"Number"Output value type for a single draw. Vec2/Vec3: each component randomized independently within range. Color: RGB random, A=1. Wire `source` for one Number per row instead. One of: Number, Vec2, Vec3, Color.
step_sizeNumber1Maximum random step per trigger. Value drifts within [min, max].
excludeNumber[] or Int[]—Array of values to exclude from generation. An excluded value is never emitted; the values that remain stay uniformly likely.
sourceCollection or Number[] or Vec2[] or Vec3[] or Color[] or Int[]—What to draw from. Uniform/Integer: one draw per row of this wire (unwired = one draw). Pick: one element of it. Shuffle: a permutation of it.
seedNumber0Seed for deterministic random sequence. Same seed = same sequence.
snapNumber0Quantize output to multiples of this value. 0 = no snap. 1 = integers. 0.25 = quarter steps.
biasCurve2D CurveShape of the distribution. A straight line is flat/uniform; bend it to crowd draws toward one end, or make an S to crowd them toward the middle.

Gotchas

Source means two related things, and which one depends on Mode. In Uniform and Integer it is the population: one draw per row, and the result is as long as the wire. In Pick and Shuffle it is the table being drawn from: Pick returns one of its elements, Shuffle returns a reordering of it.

Output Type (Vec2 / Vec3 / Colour) applies to a single draw only, so it disappears once Source is wired — a per-row result is one number per row.

In On Trigger timing the output holds its last value until the Trigger input crosses above Threshold. With nothing wired to Trigger the value never updates. This works with a wired Source too: the whole set of per-row values holds together and re-draws together.

Snap quantises the result to multiples of its value: 0 leaves it continuous, 1 rounds to whole numbers, 0.25 gives quarter steps. It applies to Uniform and Walk.

Max is inclusive for Integer mode and exclusive for Uniform mode. An Integer range of Min 1 / Max 6 gives a six-sided die; a Uniform range of 0–1 never returns 1.0.

Unique deals from a finite urn: the whole numbers between Min and Max. Ask for more rows than the range holds and the extra rows repeat the last value — widen Min/Max to deal more.

Two Random nodes with the same Seed draw independent sequences from each other. The seed guarantees repeatability per node, not a shared sequence across nodes.

Worked example

  1. Add a Random node. Leave Mode on Uniform and set Min/Max for the range required.

  2. Wire a set of points or shapes into Source. The output becomes one value per element instead of a single number — feed it into a size, rotation or colour to vary them all independently.

  3. Bend the Bias curve to change where the values cluster: pull it low and early to crowd them toward Min, or make an S to crowd them toward the middle.

  4. Set Timing to On Trigger and wire a pulse into Trigger to freeze the values between events instead of redrawing every frame.

  5. Switch Mode to Walk and set Step Size to make a single value drift smoothly instead of jumping.

See also

Range · Compare · Hold · Numbers, signals & audio