X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Ftwig%2Ftwig%2Fdoc%2Ffunctions%2Frandom.rst;fp=vendor%2Ftwig%2Ftwig%2Fdoc%2Ffunctions%2Frandom.rst;h=168e74f8f7dcd63b6874119a7a089c309b423879;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/twig/twig/doc/functions/random.rst b/vendor/twig/twig/doc/functions/random.rst new file mode 100644 index 000000000..168e74f8f --- /dev/null +++ b/vendor/twig/twig/doc/functions/random.rst @@ -0,0 +1,29 @@ +``random`` +========== + +.. versionadded:: 1.5 + The ``random`` function was added in Twig 1.5. + +.. versionadded:: 1.6 + String and integer handling was added in Twig 1.6. + +The ``random`` function returns a random value depending on the supplied +parameter type: + +* a random item from a sequence; +* a random character from a string; +* a random integer between 0 and the integer parameter (inclusive). + +.. code-block:: jinja + + {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} + {{ random('ABC') }} {# example output: C #} + {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} + {{ random(5) }} {# example output: 3 #} + +Arguments +--------- + +* ``values``: The values + +.. _`mt_rand`: http://php.net/mt_rand