Не самый лучший вариант, т.к. очень сильно нагружает систему, но если данных немного, то можно как-то так
function myFunction() {
  const arr = [1, 2, 2, 3, 34, 54, 3, 4, 45, 34, 53, 45, 4, 1, 23, 12, 3, 235, 2, 5, 1, 2, 6, 76, 54, 6, 84, 5, 23, 2, 34, 6, 735];
  const done = [];
  let attempts = 5;
  while (attempts--) {
    const a = [...arr];
    const res = [];
    const exclude = [];
    while (a.length) {
      const index = Math.floor(Math.random() * a.length);
      const v = a[index];
      if (exclude.indexOf(v) === -1) {
        a.splice(index, 1);
        res.push(v);
        exclude.push(v);
        if (exclude.length > 4)
          exclude.shift();
      } else if (!a.filter(v => exclude.indexOf(v) === -1).length) {
        console.log('break', a, exclude);
        break;
      }
    }
    if (!a.length) {
      done.push(...res);
      break;
    }
  }
  console.log(done);
}
Пример в Таблице 
https://docs.google.com/spreadsheets/d/1lUHQ89Dsc6...