Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

Template Filter - random


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.


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

{{ value|random }}