Minecraft Data Packs / Adventure

Totally random RNG (1 to 2^32)

  • check_circle Functions
  • 1,683 views, 3 today
  • 84 downloads, 0 today
AxoSpyeyes's Avatar AxoSpyeyes
Level 26 : Expert Miner
5
I haven't used tropical fish randomizers, since those are really not random enough. I used them for a server, but I kept getting the same numbers! So I now sat down, and figured out a solution.

I take two armor stands, and I pick a random one of them. Then I detect which one it picked, and I'll add that to a variable. Then i randomize, but this time I multiply it by 2, and then add to the variable. Then 4, then 8, 16, 32, and so on and so on.

Then I take the "%=" of it, which basically divides it by a number you pick, until it cant anymore, and then it spits out what's left. (it also plusses it with one, since it will pick from 0-9, if you pick the number 10)This means, that you, yourself set the number (RNGint), and it'll pick a random number between 1 and the number you picked!


Tutorial for dummies:
Change the score "RNGint" to the range of numbers you want (ex. 10);
  /scoreboard players set @e[tag=01RNG,tag=1] RNGint (Number range)

And to extract the number, you need to call the same entity (@e[​tag=01RNG,tag=1])
  /scoreboard objectives setdisplay sidebar RNG


Note: it updates the random number every tick
CompatibilityMinecraft 1.13
toMinecraft 1.17
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome