Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Template Filter - random


Example

Return a random list item:

<h1>My favorite fruit is {{ fruits|random }}</h1>
Run Example »

Definition and Usage

The random filter returns a random item of an object.


Syntax

Template filters are defined by using a pipe | character followed by the name of the filter.

{{ value|random }}