remove duplicates

This commit is contained in:
Timotej Rybársky 2023-04-07 13:17:43 +02:00
parent f94369256d
commit a0493c4733

@ -203,8 +203,24 @@ function showImages(word) {
var now_count = tmp_tabl.length;
var tmp2_tabl = [];
tmp_tabl.forEach((element) => {
if (!tmp2_tabl.includes(element)) {
tmp2_tabl.push(element);
}
});
tmp_tabl = tmp2_tabl;
while (now_count < tocount){
tmp_tabl.push(getRandomElement(data_tabl));
var hasORiginal = false;
while(!hasORiginal){
var newthing = getRandomElement(data_tabl);
if (!tmp_tabl.includes(newthing)){
tmp_tabl.push(newthing);
hasORiginal = true;
}
}
now_count++;
}