4

Help with random numbers

Kraggle0912/5/24 5:12 pm
12/6/2024 11:06 pm
ICanGamez
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 33 : Artisan Procrastinator Explorer
27

Create an account or sign in to comment.

4

ICanGamez
12/06/2024 10:03 pm
He/Him • Level 55 : 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
1
Kraggle09
12/06/2024 10:51 pm
He/Him • Level 33 : Artisan Procrastinator Explorer
Why did I never see that a /random command exists?! That’s so helpful, thanks a lot!
2
ICanGamez
12/06/2024 11:06 pm
He/Him • Level 55 : Grandmaster Blockhead Imposter
no worries!! glad I could help ya out!
1
SuperYosh23
12/05/2024 5:21 pm
Level 5 : Apprentice Engineer
I would help but reddit is blocked on my home network :P
1

Welcome