var clientWidth = document.documentElement.clientWidth;
var columQty = Math.floor(clientWidth / 16);
var randNumbersArray = [];
function getRandomNum(min,max){
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var makingColumsInterval = setInterval(function(){
var randomNum = getRandomNum(1, columQty);
if(randNumbersArray.length == 0){
randNumbersArray.push(randomNum);
} else if(randNumbersArray.length == columQty){
clearInterval(makingColumsInterval);
} else{
for(var i = 0; i <= randNumbersArray.length-1; i++){
if(randomNum == randNumbersArray[i]){
i--;
break;
} else{
randNumbersArray.push(randomNum);
break;
}
}
}
// clearInterval(makingColumsInterval);
},100);
if(randomNum == randNumbersArray[i])
for(var i = 0; i <= randNumbersArray.length-1; i++){
if(randomNum == randNumbersArray[i]){
i--;
break;
} else{
randNumbersArray.push(randomNum);
break;
}
}
let arr = [1,1,2,3];
Array.from(new Set(arr)); // [1,2,3]