How to get random 3 data from a list of data source items using the Scriban template
below query, I can get all data and show accordingly but I need random 3 data from a list of data sources.
<div style="margin-top:10px"
<section class="regular slider carousel-documents slick-slider">
{{ for i_child_res in i_datasource.children }}
{{}}
{{counter=0}}
{{counter=for.index}}
{{ if counter < 4 }}
<div class="slide">
<div class="field-slideimage">
{{i_child_res.ResourceImage}}
</div>
<div class="slide-info">
<div class="field-slidetext">
<div class="quantum-cta_tag-share">
<h4 class="quantum-cta-sub__title">{{i_child_res.ResourceCategory}}</h4>
</div>
<h1>{{i_child_res.ResourceTitle}}</h1>
<p class="campaign-cta-content">{{i_child_res.ResourceDescription}}</p>
<div class="tags-group">
{{ for i_child_rest in (sc_followmany i_item "ResourceTags") }}
<span class="tags">{{i_child_rest.dataName}}</span>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{end}}
</section>
</div>
math.random <minValue> <maxValue>
-github.com/scriban/scriban/blob/master/doc/… You can run the loop three times and get the random value from your list by passing 1 as minValue and list length as maxValue. I didn't try it but I think this can be an option.