4

Help with random numbers

Kraggle09 12/5/24 5:12 pm
186
2/16/2025 9:15 am
So I’ve been conceptualizing a datapack, and I’ve figured out how to do everything but one: Random numbers.

I found this Reddit page, which would work, except I can’t figure out what I would change on it to change the range (e.g. 0.36-2.08).


So my question is a) how do I easily generate a random number using a function, or b) how do I specify the range on the implementation mentioned above.
Posted by
Kraggle09
Level 45 : Master Procrastinator
216

  Have something to say?

JoinSign in

5

sniffercraft34
02/16/2025 9:15 am
He/Him • Level 78 : Legendary Mythical Sniffer
try execute store result score <entities> <score> run random roll <min>..<max>
3
ICanGamez
12/06/2024 10:03 pm
He/Him • Level 61 : High Grandmaster Blockhead Imposter
depends on what version, if you have access to the /random roll command then this is the easiest way to do it.
just do
/execute as @a at @s store result score @s SCORE_HERE run random roll 1..100
but this reddit post was talking about a loooong ago random numb generator
2
Kraggle09
12/06/2024 10:51 pm
He/They • Level 45 : Master Procrastinator
Why did I never see that a /random command exists?! That’s so helpful, thanks a lot!
3
ICanGamez
12/06/2024 11:06 pm
He/Him • Level 61 : High Grandmaster Blockhead Imposter
no worries!! glad I could help ya out!
2
SuperYosh23
12/05/2024 5:21 pm
Level 11 : Journeyman Pancake Waffle
I would help but reddit is blocked on my home network :P
1

Welcome