The css class of the slider must of course be adapted. In this example, a separate class has been assigned with the name “mainslider”.
<script> (function () { let randomSliders = document.querySelectorAll('.mainslider .swiper-wrapper, .mainslider .swiper'); randomSliders.forEach(slider => { let images = slider.children; let frag = document.createDocumentFragment(); while (images.length) { frag.appendChild(images[Math.floor(Math.random() * images.length)]); } slider.appendChild(frag); }); }()); </script>