You might have already encountered this block however if you haven’t its a simple but powerfull block which as the name implies lets the code choose a random number.

It will choose a random number between the numbers in the two white fields.
Heres an example of it in action:
https://scratch.mit.edu/projects/352269125/editor