const arr = Array.from(Array(50), () => Math.random()*1500); // пусть от 0 до 1.5 сек
const request = (n) => n === undefined ? Promise.resolve() : new Promise(resolve => setTimeout(resolve, n));
const delay = () => new Promise(resolve => setTimeout(resolve, 1000)); // 1 sec
async function queue(arr) {
const _arr = arr.slice();
while (_arr.length) {
await Promise.all([
request(_arr.pop()),
request(_arr.pop()),
request(_arr.pop()),
delay(),
])
}
}
const randomElement = (arr) => arr[Math.floor(Math.random() * arr.length)];