execute store result score world Spawning_Rolled run random value 1..7

# Triple check for same waves back to back.
# If it passes all three (1/n^4) probability, the same wave will spawn
execute if score world PreviousWaveRoll = world Spawning_Rolled run execute store result score world Spawning_Rolled run random value 1..7
execute if score world PreviousWaveRoll = world Spawning_Rolled run execute store result score world Spawning_Rolled run random value 1..7
execute if score world PreviousWaveRoll = world Spawning_Rolled run execute store result score world Spawning_Rolled run random value 1..7

execute store result score world PreviousWaveRoll run scoreboard players get world Spawning_Rolled

execute if score world Spawning_Rolled matches 1 run function kiwi2:waves/wave_1/set_1/3_phantom_wave
execute if score world Spawning_Rolled matches 2 run function kiwi2:waves/wave_1/set_1/4_creeper_wave
execute if score world Spawning_Rolled matches 3 run function kiwi2:waves/wave_1/set_1/7_skeleton_wave
execute if score world Spawning_Rolled matches 4 run function kiwi2:waves/wave_1/set_1/8_spider_wave
execute if score world Spawning_Rolled matches 5 run function kiwi2:waves/wave_1/set_1/10_zombie_wave
execute if score world Spawning_Rolled matches 6 run function kiwi2:waves/wave_1/set_1/12_silverfish_wave
execute if score world Spawning_Rolled matches 7 run function kiwi2:waves/wave_1/set_1/miniboss_crypt_giant