Skip to content Skip to footer navigation

Random Modifier

Overview

Picks a single random item from an array or collection.

If you are trying to get multiple random items, consider the shuffle modifier.

Example

The YAML

arr:
- Soda
- Pop
- Coke

The Template

{{ arr | random }}
{{ Statamic::modify($arr)->random() }}

The Output

Soda (maybe)