JSFiddle - React, Tailwind, and code Playground
HTML
<ul id='result'></ul>
JavaScript
function shuffle(list) {
var shufflings = [];
while(true) {
var clone = list.slice();
var shuffling = [];
var period = 1;
while(clone.length) {
var index = Math.floor(shufflings.length / period) % clone.length;
period *= clone.length;
shuffling.push(clone.splice(index,1)[0]);
}
shufflings.push(shuffling);
if(shufflings.length == period) return shufflings;
}
}
var result = shuffle(['a', 'b', 'c', 'd', 'e']);
document.getElementById("result").innerHTML = "<li>" + result.join("</li><li>") + "</li>";