const button = document.querySelector(".shuffle");
const wrapper = document.querySelector(".wrapper");
const image = document.querySelectorAll(".image")
button.addEventListener("click", () => {
const images = [...image];
const shuffled = shuffle(images);
shuffled.forEach(el => wrapper.appendChild(el));
})
function shuffle(arr) {
let newArr = arr.slice();
let i = newArr.length;
let r;
let temp;
while (i--) {
r = Math.floor(Math.random() * (i + 1));
temp = newArr[i];
newArr[i] = newArr[r];
newArr[r] = temp;
}
return newArr;
}
<div class="wrapper">
<div class="image">
el1
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el2
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el3
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el4
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el5
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el6
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el7
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el8
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el9
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
<div class="image">
el10
<img src="https://trikky.ru/wp-content/blogs.dir/1/files/2020/04/22/1564314090_3.jpg">
</div>
</div>
<button class="shuffle">
shuffle
</button>
https://jsfiddle.net/mvye5r2q/23/