function random(ary){
    return ary[Math.floor(Math.random()*ary.length)];
}

var tippedArrows = [
'cyclic:stun', 
'minecraft:weakness', 
'atmospheric:worsening',
'immersiveengineering:sticky',
'occultism:third_eye',
'apotheosis:sundering'
];

var specialArrows = ['minecraft:spectral_arrow', 'archers_paradox:frost_arrow', 'archers_paradox:frost_arrow', 'archers_paradox:ender_arrow', 'archers_paradox:phantasmal_arrow', 'archers_paradox:quartz_arrow', 'archers_paradox:shulker_arrow', 'archers_paradox:slime_arrow', 'apotheosis:obsidian_arrow', 'archers_paradox:blaze_arrow', 'archers_paradox:blaze_arrow'];



onEvent('entity.spawned', event => {

    if(event.entity.type == 'minecraft:skeleton') {
        
        event.server.scheduleInTicks(1, cb => {
        
        var UUID= event.entity.getFullNBT().UUID;
        var cleanUUID = '[I;'+UUID.toString().substring(1);
		
	var arrowFormula = [('id:"minecraft:tipped_arrow",tag:{Potion:"'+random(tippedArrows)+'"},Count:1'), ('id:"'+random(specialArrows)+'",Count:1'), '', '', '', '', '', '']
	  
	  event.server.runCommandSilent('data merge entity @e[nbt={UUID:'+cleanUUID+'},limit=1] {HandItems:[{id:"minecraft:bow",Count:1},{'+random(arrowFormula)+'}]}');
    });
}
})
