(() => {
'use strict';
const backgrounds = ['path1', 'path2', 'path3', 'path4'];
const selectedIndex = Math.floor(Math.random() * backgrounds.length);
const selectedBackground = backgrounds[selectedIndex];
document.body.style.backgroundImage = `url(${selectedBackground})`;
})();
Coś w ten deseń :)