Why won't that card drop, and why did your armor break three times in a row? Here is how the game rolls its dice, and whether it cheats. Spoiler: it doesn't. Fair luck is simply meaner than it feels.

What happens behind the scenes

Picture a tabletop game. There are players, and there is a game master sitting behind a screen. You say: "I hit the dragon!" The game master rolls a die behind the screen and tells you the result. You never see the die and you can't swap it.

ZeRO works the same way. The game on your computer is the player. All it does is ask: "attack", "refine", "pick up". The game master is the server, a big computer where the whole game world lives. It rolls every die and sends the answer back to your game.

The game asks, the server rolls the die behind a screen and sends the answer

Your game asks, the server decides. Nobody can roll the die for it.

A magic bag of marbles

A six-sided die is too simple for the game. Instead of a die, the server has a bag of 10,000 marbles, each with its own number from 0 to 9999.

Say a refine has a 60% chance. Then 6,000 marbles are gold, meaning "success", and 4,000 are grey, meaning "failure". The server draws one marble without looking, checks its colour, puts it back and shakes the bag. The next attempt is drawn from a full bag again.

A bag with 6,000 gold marbles out of 10,000

A 60% chance means 6,000 gold marbles out of 10,000.

Almost every chance in the game works like this: whether a monster drops an item, whether a refine succeeds, whether you hit, whether you land a critical. The chances themselves, that is, how many gold marbles are in the bag, come from the original game's tables.

So who shakes the bag?

There is no real bag inside a computer. There is a shuffling program called Mersenne Twister. It works like a gigantic deck of cards shuffled so well that it only repeats after you draw a number of cards that is 6,002 digits long. For comparison, the number of all atoms in the universe has about 80 digits.

Our server is written in Python, and this shuffler is built right into it. rAthena, the emulator we check the game rules against, uses exactly the same one.

When the server starts, it begins shuffling from the computer's own "noise": tiny random events in how it runs. It is like shaking a die in the dark: nobody knows which side it started on. So you can't guess the next marble from the time or from the attempt number.

Important: there is one bag for everyone. You don't have a personal "luck bar" that runs out. There is no rule that "after five failures you are bound to succeed". New and old players draw from the same bag. The only luck in the game is the LUK stat, and it works through fair formulas that everybody knows.

Results after 10 million draws

If the bag is fair, a large number of attempts should match the chances exactly. We took the same shuffler the server uses and drew marbles many, many times:

  • 10,000,000 marbles drawn — every number came up equally often.
  • 1,029 cards from 10 million monsters with a 0.01% card, against an expected 1,000.
  • 59.97% successful refines out of a million at a 60% chance.

A coin that remembers nothing

Flip a coin. Tails came up five times in a row. What are the odds of heads on the sixth flip? It feels like more than half, because heads is "due". But the coin doesn't know what happened before. It has no memory. The chance is still 50%.

The bag of marbles has no memory either. In our test we found 51 thousand cases where a 60% refine failed five times in a row, and looked at the sixth attempt. It succeeded 59.89% of the time — exactly as often as it should.

Five failures in a row, and the sixth attempt is still 60%

Every attempt starts with a full bag.

So why does the card take so long to drop?

A card with a 0.01% chance is one gold marble in a bag of 10,000. On average you will draw it within 10,000 attempts. But "on average" doesn't mean it will definitely be in your hand on attempt number ten thousand.

Imagine looking for a single gold grain of sand on a beach, where the sand gets mixed again after every try. Some people find it at once, others search for a very long time. Here is how many hunters still have no card after killing a given number of monsters:

Share of hunters without a 0.01% card by the number of monsters killed

After 10,000 monsters, 37 hunters out of 100 still have no card. Even after 20,000, one hunter in seven is still waiting.

With hundreds of hunters in the game, some of them are bound to be unlucky. They are the ones who post on the forum that the RNG is broken. The player whose card dropped from the third monster usually just celebrates quietly.

Want to know more? If you wonder why your own card is taking so long, read the forum thread «Почему карта не падает: шансы дропа на кубиках» (in Russian).

Some get a black streak, some get a white one…

Five failures in a row at a 60% chance happen only 1% of the time. Sounds almost impossible. But over 50 attempts, one player in four will see such a streak somewhere along the way. Here are 50 real attempts produced by the shuffler:

50 real attempts at 60%: 30 successes, 20 failures and a streak of five failures

30 out of 50 succeeded, exactly as expected at 60%. And still a streak of five failures is hiding in the middle.

Our brains remember streaks and forget ordinary attempts. That's why failures feel frequent even though there are exactly as many as promised.

Why it is so hard to refine armor to +7

To take armor from +4 to +7 you need three successful refines in a row. The first succeeds 60 times out of 100, the second and third 40 times out of 100. If any of them fails, the armor breaks and you have to start over.

Take 100 identical +4 armors and refine each one until it either breaks or reaches +7. Here is how many survive after each refine:

Out of 100 armors at +4, 60 reach +5, 24 reach +6 and 9.6 reach +7

Fewer than ten armors out of 100 reach +7. That's not bad luck; that's how the chance table works.

What is "Korean RNG"?

Ragnarok Online was made by the Korean company Gravity. Players have long joked that luck on its servers is "Korean": refines break more often than stated and rare items never drop. Gravity's server program is secret, nobody outside can look inside. But a few things about it are known.

The rAthena developers spent years comparing their server with the real one and found one oddity in how Gravity's server draws marbles. Let's go through it step by step.

Step 1. One big drum for everything

It looks like Gravity's server has a single lottery drum, with marbles numbered from 0 to 20,000. Why exactly that size, nobody outside can tell: the program is closed. Most likely the programmers made one drum for every occasion and get a marble of the right size from it.

And here a small mistake hides. "From 0 to 20,000" is not 20,000 marbles but 20,001, because zero is a marble too. It's like a fence: if you put a post every metre along a 10-metre fence, you get 11 posts, not 10.

Step 2. The marble has to be made smaller

A chance in the game is written as a number from 0 to 10,000: a 0.01% card is 1, a 60% refine is 6,000. To compare a marble with it, you need a number from 0 to 9999. But the drum can give, say, 13,427.

The server does what a clock does. A clock face has 12 marks, and after 12 comes 1 again: 13 o'clock is 1 pm. The server's "clock face" has 10,000 marks: anything above 9999 starts a second lap from zero. Marble 13,427 becomes 3,427, marble 10,000 becomes 0, and marble 20,000 goes around two full laps and also lands on 0. Mathematicians call this the remainder of a division.

Marbles from 0 to 20,000 around a 10,000-mark clock: two full laps and one extra marble, 20,000

Two full laps give every box two marbles. The third lap is just one marble, 20,000, and it falls into box 0.

The number on the "clock" is the box number. Every box gets two marbles, but box 0 gets three.

Box 0 holds three marbles, the others two each

Box 0 gets an extra marble, so it comes up slightly more often than the others.

Step 3. How this differs from our bag

We use a bag of exactly the right size for every action. Checking whether you hit — a bag of 100 marbles. A critical — 1,000. A refine — 10,000. The bag never needs adjusting or sorting: every number is in it once, and every marble has the same chance. Strictly speaking we also have just one bag — the shuffler — but every time we ask it for a number in exactly the range we need.

Gravity always uses the same drum of 20,001 marbles, whatever it is checking. To get a number of the right size, the server sorts the marbles into boxes. The number of boxes depends on the action: 10,000 for a refine, 100 for Poison React. So what it really draws is not a marble but a box.

The marbles are sorted like dealing cards: to the first player, the second, the third… the last — and back to the first. If the deck doesn't split evenly, the first players get an extra card. For example, 10 cards among three players: three each, and the extra one goes to the first. Marbles work the same way: however many are left short of a full round, that many of the first boxes get one extra marble.

Boxes (what we divide by) Marbles in each Extra In box 0
3 6,667 0 6,667 — fair
100 (Poison React) 200 1 201
1,000 20 1 21
10,000 2 1 3
20,000 1 1 2 — twice as many

So for every action the marbles are packed into boxes differently. 20,001 marbles split evenly only into 3, 6,667 or 20,001 boxes, and the game has no chances like that. The worst case would be a chance written in twenty-thousandths: every box holds just one marble, and box 0 holds two. A 0.005% chance (1 in 20,000) would become 0.01%, twice as high. We don't know whether Gravity rolls like that anywhere, but that is how this scheme would work.

Step 4. Win or lose

Once a box is drawn, the comparison is the same as ours: if the box number is below the chance, it's a success. For example, a refine with a 60% chance, that is 6,000:

  • marble 13,427 → box 3,427 → 3,427 is below 6,000 → the refine succeeds;
  • marble 17,950 → box 7,950 → 7,950 is above 6,000 → it fails.

Now let's see what happens to the chances. A 0.01% card drops only when box 0 comes up. It holds three marbles out of 20,001, which is 0.015%, one and a half times the stated chance. A 0.02% chance wins with boxes 0 and 1: 3 + 2 = 5 marbles out of 20,001, or 0.025%. Each further box adds two marbles, while the extra marble in box 0 stays just one. So the higher the chance, the less that marble matters.

Chance in the table Winning marbles out of 20,001 Fair bag Gravity's bag
0.01% 3 0.0100% 0.0150%
0.02% 5 0.0200% 0.0250%
1% 201 1.0000% 1.0049%
50% 10,001 50.0000% 50.0025%

And here is the funny part: this mistake helps players rather than hurting them. If "Korean RNG" is rigged at all, it is rigged in the player's favour, and only a tiny bit.

The rAthena developers copy this roll only where they know for sure that Gravity rolls this way. Right now that is a single Assassin skill, Poison React with a 50% chance. There are 100 boxes instead of 10,000: each gets 200 marbles, box 0 gets 201, and the chance becomes 50.0025% instead of 50%. Monster drops and refines are rolled fairly, both by rAthena and by us.

A trap we avoided

Old programs had another problem. The C language has a standard function, rand(), and Microsoft's version of it only returns numbers from 0 to 32,767. Sort those 32,768 marbles into 10,000 boxes, and the first 2,768 boxes get four marbles each while the rest get three.

The first 2,768 boxes hold four marbles, the rest three

The first boxes get an extra marble, and the chances drift.

Then a 1% chance turns into 1.22%, and 50% into 54.2%. That can't happen in Python: it takes exactly as much randomness as it needs, throws away the extra marbles and draws again. So all our boxes get the same share.

To sum up:

  • The server rolls the dice; the game on your computer only asks and shows the answer.
  • Everyone draws from the same fair bag. Accounts have no luck of their own.
  • The bag remembers nothing: after five failures the chance is the same as before them.
  • The chances come from the original game's tables, and the roll works the same way as in rAthena.
  • Long losing streaks are normal. After 10,000 monsters, 37 hunters out of 100 still won't have a 0.01% card.
  • "Korean RNG" is a joke. The one known quirk of Gravity's server even helped players a tiny bit.

If you think some chance isn't working right, send us a bug report: what you were doing and how many times you tried. We'll check the chance against the table and the code.

The pictures in this article are labelled in Russian.

Discuss on the forum