Minecraft Data Packs / Other

Random Number Generator (RNG) for datapacks

  • check_circle Functions
  • 4,146 views, 4 today
  • 487 downloads, 0 today
  • 13
  • 10
  • 3
natural_power's Avatar natural_power
Level 42 : Master Miner
16
Get jus the .mcfunction file

A very simple and easy to use RNG for datapacks
This datapack/.mcfunction file allows you to easily generate a random number for all your randomizing needs!



HOW TO USE:

INSTALLATION:
Simply get the .mcfunction file out of the datapack and put it into your datapack!

USE:
1. Run "/scoreboard players set min rng <minimum number>" to set a minimum number
2. Run "/scoreboard players set max rng <maximum number>" to set a maximum number
3. Run "/function <pack_name>:rng" to generate the number
4. Your ranom number between the given minimum and maximum is now stored as "out" in "rng"
(Get it with "/scoreboard players operation <PLAYER> <SCOREBOARD> = out rng")

*You don't need to set the minimum and maximum every time, it'll use the last used
or the base which is min 0, max 100

CREDIT: You're free to use this datapack for anything as long as the credits that are there stay inside the .mcfunction file
CompatibilityMinecraft 1.16
toMinecraft 1.19
Tags

Create an account or sign in to comment.

justwillywastaken
12/05/2022 8:30 am
Level 72 : Legendary uwu
justwillywastaken's Avatar
very epic and awesome
1
Gebakken Lucht
10/16/2022 2:31 am
Level 26 : Expert Miner
history
Gebakken Lucht's Avatar
hi how can i execute a command if the score of "out" maches a specific number

for exaple it matches the number 2 and than it says hi it worked
2
natural_power
11/10/2022 10:00 am
Level 42 : Master Miner
natural_power's Avatar
Oof well I'm a month late to this but it'd be
/execute if score out rng matches <number> run <command>
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome