RNG prefers high values

I am making a map where one of the features is a weapon crate where you get a random weapon from a few options (that I selected). The way it works is that when you buy the crate, it triggers a trigger with a block that sets a property to a random value 0 - 6 (because there are 6 choices) then, 1 second later (any shorter and it doesn’t work for some reason) it triggers a bunch of blocks (each on an item granter) that each have the following code (I will be calling the random weapon variable I set earlier RandWeapon) : “if(RandWeapon === 0){ grantItem();}”
the zero will be replaced a number from 1 to 6 that is different on every item granter.
But here is the problem: I gave myself a starting inventory of 10000 cash to test, and found out that it gave me the weapons with higher numbers (6,5 and 4) way more than those with the low numbers (1,2 and 3). Since I had all the good weapons (legendary and stuff) on high numbers, the crate was now completely overpowered. I solved this by just putting the less good weapons on high numbers instead, but it is still a weird bug. I suspect mabey the RNG (random number generation) is messed up? any ideas for the cause or what I am doing wrong would be welcome.

could you send a screenshot of the blocks?

1 Like

How many items did you get? This could just be really bad luck.

So I made one (fish) random generator
and a repeater to repeat it 100 times
Screen Shot 2024-03-11 at 9.20.31 PM

Numbers 1,2,3: grey fish, green fish, red fish
numbers 4,5.6: blue fish, purple fish, beach fish

the numbers were pretty similar,
numbers 1,2,3 were chosen 48 times
numbers 4,5,6 were chosen 52 times

This is a really small deviation. Remember, these numbers are random so there is an equal, but not 100% chance of any of them appearing. Think of it like flipping a coin- just because you flip heads 3 times in a row doesn’t mean it’s more likely to appear than tails.

So a difference of 4 across 100 fish is nothing to worry about- if you re run this test a few times, you’re going to have slightly different results.

TL;DR: There is no problem here, it’s just weird statistics stuff and RNG isn’t broken.

(Oh crap, I thought @chrysostom was @JuliCai lol, but what I said still stands true of @JuliCai’s results are close together and not super far apart.)

2 Likes

I apologize
I am addicted
This is too fun
after running that program but for 1000 times I came back with freaky stats

IT WAS EXACTLY 50/50

yeesh ik this stuff but it still feels like its in like the 10th grade for me ._.
and yeh ive messed around in the probability sim in a calcluator but thats just like normal stuff

tried 50 times, and almost half were 5&6.