#get the amount of upgrades in total (3)
execute store result score @s mechanics_upgrade_array_size run data get storage minecraft:mechanics upgrade.list

#get the amount of upgrades in total to storage - 1 (2)
scoreboard players remove @s mechanics_upgrade_array_size 1

#store the array
execute store result storage minecraft:mechanics upgrade.array int 1 run scoreboard players get @s mechanics_upgrade_array_size

#upgrades random upgrade
function main:mechanics/upgrades/choose_random with storage minecraft:mechanics upgrade

#store randomized upgrade into storage
execute store result storage minecraft:mechanics upgrade.id int 1 run scoreboard players get @s mechanics_random

#remove the chosen upgrade from array
function main:mechanics/upgrades/remove with storage minecraft:mechanics upgrade

# #delete the list of upgrades
# data remove storage minecraft:mechanics upgrade