JSFiddle - React, Tailwind, and code Playground

by Brian Wendt

HTML

<pre id="output"></pre>

JavaScript

var output_elem = document.getElementById('output');
var output = '';
var dist = ['y','y','y','y','y','b','b','b','r','r','p'];
var v = {
	'y': 1,
    'b': 2,
    'r': 3,
    'p': 4
}

var i = 18;
while(i > 0){
	dist = shuffle(dist);
    var value = v[dist[0]] + v[dist[1]] + v[dist[2]] + v[dist[3]]
    output += dist[0] + dist[1] + dist[2] + dist[3]
    output += "\t" + value;
    
    output += "\n"; //
    i--;
}

output_elem.innerHTML = output;



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;
}