Skip to content

Randomisation

Experiments Surveys & forms

Testable provides two classic columns for controlling how trials are randomly ordered at runtime: random for shuffling individual trials and randomBlock for shuffling whole blocks. For sampling, ordered selection, constrained randomisation, and reusable orders, use the newer trialOrder column described on the Trial Sequencing page. A third level lives inside a single trial: the order of its stimuli, covered further down under stimulus-level randomisation.

Assign the same number to a group of trials to randomise their order among each other:

random = 1
random = 1
random = 1

At runtime Testable shuffles each run of consecutive rows that share the same random value. Every group shuffles within itself: rows tagged 1 reorder among themselves, rows tagged 2 reorder among themselves, and the groups do not mix. Only a row with an empty random cell stays in its original position, and it also acts as a boundary: same-valued rows on either side of it shuffle as two separate groups.

The randomBlock column randomises whole blocks of trials. A block is a set of consecutive rows with the same randomBlock value. At runtime Testable shuffles the blocks, keeping the rows within each block in their original order.

TrialrandomBlock
Instruction A1
Trial A-11
Trial A-21
Instruction B2
Trial B-12
Trial B-22

The two blocks (rows with 1 and rows with 2) will be randomly ordered, so half the participants will see Block A first and half Block B first.

Supply space-separated numbers to create nested randomisation:

randomBlock = 1 1
randomBlock = 1 1
randomBlock = 1 2
randomBlock = 1 2
randomBlock = 2 1
randomBlock = 2 2

The first number is the outer block level; the second is the inner level. Outer blocks are shuffled first, then inner blocks within each outer block.

To show each participant a random subset of your trials, use the trialOrder column with a sampling spec:

trialOrder = 1: sample 10

Every tagged row carries the group number; at runtime Testable keeps 10 randomly chosen trials from that group and drops the rest, so each participant sees a different subset. Variants:

  • 1: sample 10 difficulty keeps 10 trials per distinct value of your difficulty column, preserving the design’s balance.
  • 1: sample 10 difficulty easy samples only the easy trials down to 10 and keeps all others.
  • 1: select 10 keeps the same random choice but presents the survivors in trial file order.
  • 1: groupSample 2 difficulty keeps all trials of 2 randomly chosen difficulty values and drops the other values entirely.

Beyond sampling, ordering words in the same cell shape the order without dropping trials: limiting how many same-condition trials appear in a row (maxRun), forbidding immediate repeats (noRepeat), forcing alternation, spacing repeats apart, balancing conditions across the session, and more. Specs are checked when you save the trial file, so an impossible design is caught in the editor, never in front of a participant. The full language is documented on the Trial Sequencing page. The legacy random column cannot carry specs and cannot mix with trialOrder in one file; convert a legacy shuffle group 1 to trialOrder = 1: shuffle.

Stimulus-level randomisation: stimOptions and stimOrder

Section titled “Stimulus-level randomisation: stimOptions and stimOrder”

The columns above reorder whole trials. To reorder the stimuli WITHIN one trial, use one of two columns:

  • stimOptions containing the keyword random shuffles the trial’s stimuli freshly every time the trial is shown.
  • stimOrder holds constrained ordering specs, drawn once per participant session: random(chunk 2) shuffles consecutive pairs as wholes, random(within screens) shuffles inside each stimScreens screen while the screen structure stays fixed, and random(pin 3@3_5) pins chosen stimuli to exact or bounded positions while the rest shuffle around them.

Whichever you use, scoring follows the content: a stim-referencing key (for example key = stim2) stays correct wherever that stimulus lands, and the arrangement each participant actually saw is recorded in the stimOrder_actual results column. Worked examples: the counterbalanced sides, match to sample, paired presentation, and attentional blink recipes.

The columns work together. A common pattern:

  1. Create multiple condition blocks using randomBlock.
  2. Within each block, randomise individual trial order using random.
  3. Add a trialOrder group with a sample spec to show each participant a manageable subset of a large stimulus set.