Randomize element order and show a subset

Element order randomization varies presentation to help reduce order and selection biases. It changes which items appear, their order, or both. Configure it in the Content pane, on the group, page, or question whose children you want to vary.

For balanced variable assignments to experimental conditions, configure study design assignment in Design. Shuffling questions does not assign a participant to a study profile. Within-participant factor repetitions have their own Loop order controls in Flow.

Open Group settings for the order of pages and subgroups, Page settings for question order, or a Single choice or Multiple choice question's Settings · validation, privacy & order for option order.

The chosen order and subset are saved for that response. Going Back, reloading, or resuming the same response keeps them. A fresh response receives its own choices.

Example: show three of ten questions

  1. Open the page's ordering settings (Question order).
  2. Change Show to 3 of the ten questions. This selects a random subset, even with random ordering turned off; it does not simply show the first three.
  3. Turn random ordering on if those three should also appear in a random order. With ordering off, the chosen questions keep their authored order.
  4. Open Preview and use the page's randomization dropdown in Preview path input to choose a selection. Test another subset or order by changing that dropdown; Reset test answers keeps the choice.

The same controls apply to pages in groups and answer options in Single choice and Multiple choice questions. The heading identifies the items affected: Page order, Question order, or Option order.

For groups, Flow still determines which route is reached. Randomization cannot move a page across a branch decision. A sampled page that is excluded by the taken branch is not replaced, so participants can see fewer pages than the configured sample count. Test sampling together with your branches in Preview.

Keep instructions or “Other” in place

Set Keep first or Keep last to the number of items that must remain at that edge. Fixed items are always shown. Use 0 when an edge need not be fixed.

For example, keep the first instruction question and show three random questions after it. Set Keep first → 1, Show → 3, and uncheck Count fixed elements toward the Show limit. Participants see four items in total. Check that option instead if the fixed instruction should count toward the three.

If fixed items exceed the Show limit, they are still all shown; the editor warns you.

To keep an “Other” answer last, place it after the ordinary options and set Keep last → 1. Enable random ordering to shuffle the other options. To show two random options plus “Other”, set Show → 2 and uncheck Count fixed elements toward the Show limit.

Vary ordinal scale direction

Ordinal questions keep their values in numeric order. To show the whole scale from either end, enable Randomize ordinal direction in survey Settings or in any ordinal question's settings. These controls mirror one survey-wide setting. It starts off.

With it enabled, each participant sees either lower values or higher values on the left, consistently across every ordinal question and when returning to an earlier page or resuming. Individual values are never shuffled, and reversal does not change the value saved for an answer. See Configure an ordinal scale.

Advanced JavaScript randomization

Use Advanced JavaScript randomization only when the ordinary controls cannot express your selection. It replaces both the ordinary selection and ordering settings.

Define one randomize(refs) function. refs contains strings identifying the immediate child items:

Items being randomized Reference to use
Pages and groups Their titles.
Questions Their Question ID. Enable survey Settings → Show IDs to see it.
Choice options Their option ID, also visible with Show IDs enabled.

An ID takes precedence over a title or text. Where an item has no ID, its title, label, or prompt supplies the reference. Keep these references nonempty and unique among the items being randomized. For example, a question with ID instructions appears as "instructions" in refs, even if you change its prompt.

Return an array containing only input references, with no duplicates, in the order to show. Advanced code runs when the element is first reached; its saved selection is reused for the response.

For example, keep the first item and choose one other at random:

function randomize(refs) {
  if (refs.length < 2) return refs;
  const index = 1 + Math.floor(Math.random() * (refs.length - 1));
  return [refs[0], refs[index]];
}

Test the code in Preview before publishing. This function selects and orders existing items; use a JavaScript Flow node to calculate saved values instead.

Confirm action