remove duplicates
This commit is contained in:
parent
f94369256d
commit
a0493c4733
18
index.js
18
index.js
@ -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++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user