for (let i = 0; i < data.length; i++) {
$('.server-menu').append('<div class="server"></div>');
$('.server').attr('data-id',i);
let id = $('.server').data('id');
let server = $(`.server[data-id="${id}"]`);
}
var idArr = [];
for (var i = 0; i < $('ul').length; i++) {
while (true) {
var randomId = Math.floor(Math.random() * 100000);
if (idArr.indexOf(randomId) == -1) {
idArr.push(randomId);
break;
}
}
}
$('elem').each(function(i, elem) {
this.id = idArr.pop();
});