$('#select_all').on('click', function () {
        if (this.checked) {
            $('.check').each(function () {
                this.checked = true;
            });
        } else {
            $('.check').each(function () {
                this.checked = false;
            });
        }
    });
    $('.check').on('click', function () {
        if ($('.check:checked').length == $('.check').length) {
            $('#select_all').prop('checked', true);
        } else {
            $('#select_all').prop('checked', false);
        }
    });
Need to alter this above Select All code to only select some random amount of check boxes, like below code example. Any help for this?
$(".random-pick").click(function() {
  var maxAllowed = 6;
  // Count checkboxes
  var random_checkboxes = $("#content_subscribtion_ input.checkbox").size();
  // Check random checkboxes until "maxAllowed" limit reached
  while ($("#content_subscribtion_ input.checkbox:checked").size() < maxAllowed) {
    // Pick random checkbox
    var random_checkbox = Math.floor(Math.random() * random_checkboxes) + 1;
    // Check it
    $("#content_subscribtion_ input.checkbox:nth-child(" + random_checkbox + ")").prop("checked", true);
  }
  return false;
});
 
     
     
     
    