AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
# `random` New in version 1.5: The `random` function was added in Twig 1.5. New in version 1.6: String and integer handling was added in Twig 1.6. The `random` function returns a random value depending on the suppliedparameter type: - a random item from a sequence; - a random character from a string; - a random integer between 0 and the integer parameter (inclusive). <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1 2 3 4</pre></div></td><td class="code"><div class="highlight"><pre>{{ 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 #} </pre></div></td></tr></table> ### Arguments - `values`: The values