JSFiddle - React, Tailwind, and code Playground

HTML

<div class="randomize">
    <div class="random_div">1</div>
    <div class="random_div">2</div>
    <div class="random_div">3</div>
    <div class="random_div">4</div>
    <div class="random_div">5</div>
    <div class="random_div">6</div>
    <div class="random_div">7</div>
    <div class="random_div">8</div>
    <div class="random_div">9</div>
    <div class="random_div">10</div>
    <div class="random_div">11</div>
    <div class="random_div">12</div>
</div>

JavaScript

function shuffle(array) {
  var currentIndex = array.length
    , temporaryValue
    , randomIndex
    ;

  // While there remain elements to shuffle...
  while (0 !== currentIndex) {

    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;

    // And swap it with the current element.
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }

  return array;
}

(function ($) {
    $.fn.randomize = function (childElem) {
        return this.each(function () {
            var $this = $(this);
            var elems = shuffle($(childElem));
            $this.remove(childElem);
            for (var i = 0; i < elems.length; i++){
            $this.append(elems[i]);
            if (i <= 3){
                $(elems[i]).show();
            }else{
                $(elems[i]).hide();
            }
            }
        });
    }
})(jQuery)

jQuery(function($){
    $("div.randomize").randomize("div.random_div");
});