scoreboard players tag @e add chest {Item:{id:minecraft:chest},OnGround:1b}

execute @e[tag=chest] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:minecraft:wooden_sword,Count:1b},Tags:[loot]}

execute @e[tag=chest] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:minecraft:diamond_sword,Count:1b},Tags:[loot]}

execute @e[tag=chest] ~ ~ ~ kill @r[type=Item,c=1,tag=loot]

kill @e[tag=chest]