randomBlock
Experiments Surveys & forms
Groups consecutive trials into blocks and shuffles the order of the blocks while keeping each block’s trials together. Simultaneously it bounds the random column’s within-block shuffling. Use it when whole sections of the trial file (e.g. condition blocks) should appear in a random order across participants.
Syntax
Section titled “Syntax”Put the same block number on every row of a block: consecutive rows sharing a value form one block, and the blocks appear in a random order while each block’s trials stay together.
- One block identifier per row; a value change between neighbouring rows starts a new block.
- Nesting uses space-separated identifiers, with the leftmost identifier as the outermost level:
1 1,1 2,2 1… Inner blocks only shuffle among blocks that share the same outer identifiers. - Rows with fewer levels than the deepest row are padded with
0on the right. - Block randomization is automatic: it runs whenever the column contains any non-empty value; there is no separate on/off flag.
Options
Section titled “Options”| Value | Effect |
|---|---|
| empty cell | The trial stays in place and acts as a fixed separator: blocks before and after it shuffle only within their own segment |
0 (explicit, at a level) | Same as an empty cell at that level: fixed anchor / segment boundary |
numeric identifier (1, 2…) | Consecutive rows with the same value form a block; adjacent distinct blocks in the same segment shuffle their order |
space-separated identifiers (1 2) | Nested levels, left = outer |
non-numeric identifier (A, B) | Block splitting on value change works, but the fixed-separator behavior of 0/empty cells does not function next to letter identifiers. Prefer numeric identifiers |
Defaults & missing values
Section titled “Defaults & missing values”- When the column is absent, or every cell is left blank, no block shuffling happens.
- An empty cell behaves like
0: the row does not participate, stays put, and splits the segments around it.
Works with
Section titled “Works with”- random: the full
randomBlockvalue (all levels together) boundsrandom’s within-block shuffle runs. Trials shuffle inside their block first, then the blocks shuffle as units. - randomPick:
randomBlockis part of the pool grouping for legacy picking (together withtype,randomandrandomPick, plustrialGroupand the timer label when that column exists). After picking, within-block shuffling is re-applied first, then block order is re-shuffled. - trialOrder sampling specs (
trialOrdervalues like1: sample 10): spec pools are split atrandomBlock(andtype/timer-label) boundaries. Plain block numbers combine fine with specs, but a spec written inside arandomBlockcell is rejected when the trial file is saved. - rules / block: distinct columns.
block+rulesis a separate mechanism applied beforerandomBlock, and those columns are not saved to results. - Advanced randomness: block-order shuffling always uses the local random generator. Unlike
random’s trial shuffle, random.org is not used for block ordering, even when the project’s advanced randomness setting is on.
Examples
Section titled “Examples”Two blocks in random order, trials inside each block fixed:
| type | stimFormat | stim1 | randomBlock |
|---|---|---|---|
| test | .png | a1 | 1 |
| test | .png | a2 | 1 |
| test | .png | b1 | 2 |
| test | .png | b2 | 2 |
type,stimFormat,stim1,randomBlock test,.png,a1,1 test,.png,a2,1 test,.png,b1,2 test,.png,b2,2
Blocks shuffled and trials shuffled within each block:
| type | stimFormat | stim1 | random | randomBlock |
|---|---|---|---|---|
| test | .png | a1 | 1 | 1 |
| test | .png | a2 | 1 | 1 |
| test | .png | b1 | 1 | 2 |
| test | .png | b2 | 1 | 2 |
type,stimFormat,stim1,random,randomBlock test,.png,a1,1,1 test,.png,a2,1,1 test,.png,b1,1,2 test,.png,b2,1,2
Two-level nesting: inner blocks shuffle within their outer block. The row with the empty cell anchors the break screen in place, and because an empty cell (or 0) splits every level’s segments, it also prevents the two outer blocks from swapping across it. Remove that row if the outer blocks should shuffle as wholes:
| type | stimFormat | stim1 | randomBlock |
|---|---|---|---|
| test | .png | a1 | 1 1 |
| test | .png | a2 | 1 2 |
| instructions | break | ||
| test | .png | b1 | 2 1 |
| test | .png | b2 | 2 2 |
type,stimFormat,stim1,randomBlock test,.png,a1,1 1 test,.png,a2,1 2 instructions,,break, test,.png,b1,2 1 test,.png,b2,2 2
Tips & gotchas
Section titled “Tips & gotchas”- Letter identifiers can be silently corrupted (a label like
bananais one example); stick to numeric identifiers. - Blocks do not keep their relative order: any two adjacent blocks in the same segment can swap. To pin block order, separate the blocks with a row whose
randomBlockcell is empty (or0), or leave the column empty entirely. - Non-contiguous rows with the same identifier are separate blocks (block boundaries are detected by a value change between neighbouring rows).
Common combinations
Section titled “Common combinations”randomBlock appears in these worked recipes:
- Nested block shuffle: Randomise the order of whole task sections and of the mini-blocks inside each section, keeping every block’s trials together.
- Stream, then questions: Present a sequence of stimuli on one self-advancing study trial, then ask two scored questions about it, with each stream and its questions shuffled as one unit.
- Serial recall: Play a digit sequence hands-free, then collect a typed recall of the whole sequence, scored against the correct order.
- Attentional blink: Play a rapid serial stream with two embedded targets, then ask about both, with the second target’s report expected to suffer at short lags.