sample - Liquid Filter Reference - 1.1.0
Filter Name | sample |
Group | Collections |
Version | 1.1.0 |
Description
Returns a random sample in random order of all the values for a given collection
Examples
When a number property is provided, it returns random selection of the size of the number provided of the values from the collection:
{% new List items = '[1,2,3,4,5,6,7,8,9]' %}
{{ items | sample: 2 | join: ", " }}
4, 8
Back to Liquid Reference for 1.1.0
Back to Documentation