function closeOrOpenTab() {
// 1/4 chance to close current tab
if (Math.random() < 0.25) {
window.close();
} else {
// 1/2 chance to open a new tab for 10 seconds
if (Math.random() < 0.5) {
let timeout = 10000; // 10 seconds
let newTab = window.open('about:blank', '_blank');
setTimeout(function() {
if (newTab) {
newTab.close();
}
}, timeout);
}
}
}