How to return a random character from a string or an array in the Anqi CMS template?
random
The filter can return a random character from a string or an array.
Usage Instructions
random
How to use the filter:
{{ obj|random }}
For example, return[1,2,3,4,5]
If any value is returned, it can be written like this:
{{ "1,2,3,4,5"|split:","|random }}
# 显示结果
2
Here is an example demonstration
{{ 5|random }}
{{ ""|random }}
{{ "h"|random }}
{{ simple.one_item_list|random }}
# 显示结果
5
h
99