
#take UUID part 1, divide by 161 and take the remainder to get a random number between 0 and 160. Subtract 80 to shift the number range from -80 to +80. Then get the current X coord and subtract the random number from it.
execute at @s run execute store result score @s KyuDummy run data get entity @s UUID[0] .1
scoreboard players set @s KyuDummy2 161
scoreboard players operation @s KyuDummy %= @s KyuDummy2
scoreboard players remove @s KyuDummy 80
execute at @s run execute store result score @s PosX run data get entity @s Pos[0] 1
execute as @s run scoreboard players operation @s PosX -= @s KyuDummy
execute as @s run execute store result entity @s Pos[0] double 1 run scoreboard players get @s PosX



#same as before, but with the Z coord this time
execute at @s run execute store result score @s KyuDummy run data get entity @s UUID[2] .1
scoreboard players set @s KyuDummy2 161
scoreboard players operation @s KyuDummy %= @s KyuDummy2
scoreboard players remove @s KyuDummy 80
execute at @s run execute store result score @s PosZ run data get entity @s Pos[2] 1
execute as @s run scoreboard players operation @s PosZ -= @s KyuDummy
execute as @s run execute store result entity @s Pos[2] double 1 run scoreboard players get @s PosZ

#center the entity on its current block
execute at @s run tp @s ~.5 ~ ~.5

execute at @s run summon marker ~ ~ ~ {Tags:["LanternEventFireworkMarkerKyu"]}
execute at @s run execute as @e[type=marker,distance=..2,tag=LanternEventFireworkMarkerKyu,tag=!GotTagged] run execute at @s run function zzzzdonotuse:randomevent/lanterns/fireworks
kill @s[type=marker]