how to pick a random number with minecraft commands code example

Example: minecraft random number

# Bedrock
scoreboard players random <player: target> <objective: string> <min: int> <max: int>

# Java
## Many options, sadly none are as easy as the one above.
## Probably the one with the least commands is this one:
summon area_effect_cloud ~ ~ ~ {Tags:["random_uuid"]}
execute store result score @s random run data get entity @e[type=area_effect_cloud,tag=random_uuid,limit=1] UUID[0] 1
kill @e[type=area_effect_cloud,tag=random_uuid]

Tags:

Misc Example