JSFiddle - React, Tailwind, and code Playground
by BurpmanJunior
JavaScript
console.clear();
var RANGE,
PEOPLE,
iteration;
RANGE = [1, 365];
PEOPLE = 23;
iteration = function(r, m){
var p = [];
for(var i = 0; i < m; i++){
p[i] = r[0] + Math.round(Math.random() * r[1]);
}
return p;
}
//
var res = [];
for(var i = 0; i < 10; i++){
res[res.length] = new iteration(RANGE, PEOPLE);
}
console.table(res);
console.log(res);
var m = [];
res.forEach(function(r, n){
var rm = [],
tm = {};
r.forEach(function(p){
if(tm[p]){
rm[rm.length] = p;
}
tm[p] = p;
});
if(rm.length){
m[m.length] = [n, rm];
}
});
console.log(m);
console.log(m.length);
if(m.length){
console.log(m[0][0]);
}