execute store result score length func.temp run data get storage func:temp shuffle.list execute if score length func.temp matches 0 run return 1 execute store result score random func.temp run random value 0..2147483646 scoreboard players operation random func.temp %= length func.temp function func:shuffle/f2 with storage func:temp {index:0} execute store result storage func:temp shuffle.index int 1 run scoreboard players get random func.temp function func:shuffle/f2 with storage func:temp shuffle