diff --git a/doc/functions/index.rst b/doc/functions/index.rst index d3a5febea..5159283ec 100644 --- a/doc/functions/index.rst +++ b/doc/functions/index.rst @@ -7,6 +7,7 @@ Functions range cycle constant + random attribute block parent diff --git a/doc/functions/random.rst b/doc/functions/random.rst new file mode 100644 index 000000000..4f62f498c --- /dev/null +++ b/doc/functions/random.rst @@ -0,0 +1,11 @@ +``random`` +========== + +.. versionadded:: 1.5 + The random function was added in Twig 1.5. + +The ``random`` function returns a random item from a sequence: + +.. code-block:: jinja + + {{ random(['apple', 'orange', 'citrus']) }}