Get random entries from a section but keep the order of these when splitting the array
One way I have achieved this is like so:

{% for entry in artists %}
  {% if loop.first %}
    &lt;div class="flex flex-wrap items-center"&gt;
  {% endif %}
  {% if loop.index == 5 %}
    &lt;/div&gt;
    &lt;div class="flex flex-wrap items-center lg:ml-20"&gt;
  {% endif %}
  &lt;figure class="w-1/4 sm:w-100px mb-0 border border-white"&gt;
    {% include '_includes/_components/image.twig' with {
      image: entry.artistImage[0],
      alt: 'Artists',
      transform: 'square',
      classes:'w-full',
      sizes:'(min-width:576px), 100px, 25vw',
      widthEnd: 800
    } %}
  &lt;/figure&gt;
  {% if loop.last %}
    &lt;/div&gt;
  {% endif %}
{% endfor %}


But I think this circumvents the issue rather than solves the question.