What to expect of computer randomness

Long weekend give enough time for idle thoughts. So I got curious about computer random number generation and what to expect of it.

Disclaimer: This is not about E&P itself because I have no insight about its implementation of randomness. It is just a simple test of commonly used Pseudo Random Number Generator that is available in many programming languages.

Since Android development is in fact Java I wrote a simple code in Java that uses standard Random() class and simulates summons.
Odds were taken from an event portal:

Rare Classic Hero: 63.1
Epic Classic Hero: 20.8
Legendary Classic Hero: 1.5
Rare Event Hero: 7.9
Epic Event Hero: 5.7
Legendary Event Hero: 1.0

One summon: Integer range from 0 to 999 was divided into sub-ranges according to mentioned above percentage. Random.nextInteger(1000) produces a pseudo random number between 0 and 9999. Then I checked what sub-range it hit and that was an output of a summon.

Program performed 1000 series of 10 000 summons each. In each series a seed was taken at random as well.

Expected probability Min probability Max probability Average probability
Rare Classic Hero 63.1 61.34 64.3 63.094
Epic Classic Hero 20.8 19.6 22.19 20.803
Legendary Classic Hero 1.5 1.1 1.99 1.507
Rare Event Hero 7.9 7.06 8.69 7.89
Epic Event Hero 5.7 5.03 6.43 5.708
Legendary Event Hero 1.0 0.62 1.3 0.997

Additionally I checked the longes sequence of classic 3* heroes. It turns out to be 38 consequent 3* heroes.

So an algorithm of computer random number is on average even and mean values match declared. However, in each particular case there is a deviation and based on your luck you may have batter or worse odds depending on a seed you’ve got.

10 Likes

Now I changed the conditions of an experiment. 10x summon repeated 10 000 times.

Here are the results:

Expected probability Min probability Max probability Average probability
Rare Classic Hero 63.1 0.0 100.0 63.101
Epic Classic Hero 20.8 0.0 80.0 20.813
Legendary Classic Hero 1.5 0.0 40.0 1.521
Rare Event Hero 7.9 0.0 60.0 7.891
Epic Event Hero 5.7 0.0 60.0 5.675
Legendary Event Hero 1.0 0.0 30.0 0.999

So, if you do a 10x pull and this algorithm is in use, you have a chance to get no annoying 3* at all and up to 3 event 5*. But on the other hand you can get all 3* or 8 classic 4*. :slight_smile: Randomness at full.

9 Likes

3w9dyq

Thanks @SuuriKoira

I love to learn about this stuff and how E&P might work under the bonnet

6 Likes

Lesson #1: if you do 100 10-pulls, you can reasonably expect a result close to the average/expected result; not so much if you do one.

Rounded got the nearest whole hero, an average 10-pull looks like:

  • 6 classic 3*
  • 2 classic 4*
  • 1 event 3*
  • 1 event 4*
  • no 5* of any kind

I would be curious to see in your simulation of 10,000 runs how many came out like that, and how many fit into other categories of “good” or “bad”

1 Like

What is a definition of “good” and “bad”?

I have already explained it in another post but a lot of game companies are not using pure randomness for summons generation to avoid this min prob and max prob and to get every time exactly the numbers they want.

It’s a technique called “box gacha”. They generate determined boxes of heroes with correct % and let the players pick inside these boxes until they are empty. That way, they are sure that the odds are always the same. The big downside on this method is that most of the time, players will have in fact 0 chance to get the legendary they are chasing for, if the box the game server is assigned them is already empty for this legendary.

1 Like

So far I’ve got this (10x pulls repeated 10,000 times):

6 classic 3*: 2479 24.79%
2 classic 4*: 3149 31.49%
1 event 3*: 3755 37.55%
1 event 4*: 3419 34.19%
At least one classic 5*: 1392 13.92%
At least one event 5*: 963 9.63%
No 5* of any kind: 7770 77.7%

1 Like

As I said in a first post I have no ideas how exactly portal is implemented in the game. I don’t even know whether a hero is generated on a client or on a server. I just took a common implementation of RNG and used it in a most straightforward way.

Interesting. I’m not quite sure understand it, but I don’t have to code these things :rofl:

If SG started using a “box gacha”, would the way they describe the odds of a summon have to read differently than they currently do? I ask because SG seems to be honest in what they disclose about the game–Yes, there are many things they don’t disclose, but the few instances where things didn’t match what they claimed, that was followed by an apologetic correction or a bug fix.

1 Like

Looking at the 25~37% chance of each of the 4 components of my “average” 10-pull, and multiplying them together, even tho that is average/expected/most common, that exact combination looks to only occur roughly 1% of the time. :rofl: Can you give a count from your simulation and see if I was correct?

Actually I’m pretty sure that all classic 3*s is going to be more likely than that even though it isn’t the average/expected result. Statistics gets weird in a hurry, and I’m doing much of the math in my head, making it even weirder…

A few more interesting definitions of “bad” might be:

  • All classic 3*
  • All 3* (classic + event)
  • All classic 3* and 4* heroes
  • All classic heroes

Some new interesting definitions of “good”:

  • 2-10 event 4* (more than 1)
  • 2-10 event 3* (more than 1)
  • No classic heroes

Given how low the odds of 5* are, calculations with more than 1 of them would be interesting, but probably not worth bothering to check on.

White noise for da HotM. :alien:

Yes, it doesn’t look right. It is likely I have a bug in this code. I’ll check it.

It seems bizarre at an intuitive level to me but intuition often goes badly wrong on statistics, and I wouldn’t be surprised to find it to be correct.

I remember reading that in the WW2(?) era pilots had a problem operating planes because most/many of them couldn’t reach the controls comfortably.

The military had found the average enlisted man’s body dimensions in a bunch of things, arm/leg lengths, torso length, and a few others … then got the plane contract to make cockpits that fit the average.

Turns out that while it was average, almost nobody was average in every way!

The solution was to come up with normal ranges for each measurement and make the cockpit adjustable for all of them. Then the planes were comfortable to operate for 90% or better of the pilots.

So seeing the precise “average” or “expected” result being rare doesn’t surprise me hugely.

1 Like

I’ll tell you what I expect…I expect to be disappointed. That’s why I stopped playing the lottery and only spend money and gems if I know what I’m getting (like the spring offerings with mats). The rest of the deals, like the “get at least 2 of the following” and “Increased chance at a legendary”…you get better odds at a casino. I’m not saying it’s a scam, I’m saying house always wins.

2 Likes

It is easy for the house to win when you pay real dollars in and they give you bits on their server when you “win”. Actually you always get bits, but winning means getting better ones. :rofl:

3 Likes

Well, there is money they have to pay developers to make those bits, they have to maintain their servers, overhead costs, taxes etc., so I get it, they have to make money somehow. And I understand that in order to be competitive, they can’t just give away their “bits” to everyone.
But when someone puts their greenbacks on the line, and all they get in return is “if you’re lucky you’ll get Joon, but you’ll probably get Dawa, because math”…I’m not playing those odds, not in this economy lol.
A 10-pull costs $26, and you’ll probably get a 4* out of it, maybe 2, rarely a 5*. Let’s say you want 3 4*-5* players of every color, so you can color stack them 3-2. That’s easily 10 10-pulls at $26 a pop ($260), and that’s only if you don’t care whom you pull. You can buy a PlayStation for that money.

So the developer in me is annoyed at the thread title… as this isn’t what you should expect of computer randomness, but of ANY randomness. The Linux pseudo random number generator is EXTREMELY good at creating random numbers. There’s also a true random source (that takes values from external sources), but it’s almost never used because it’s not needed.

As someone said earlier, humans are REALLY bad at statistics. I once had a math professor that showed this by assigning half the class to write down 100 actual coin flips, and the other half to just fake doing so. He could always tell which was which because the fake ones would never do 5 heads or tails in a row, while reality is that this is a highly likely event.

EVERY result is independent of the others. You are NEVER “owed” a result. There is no conspiracy, no man behind the curtain, no bias. Humans are made to find patterns, so we want there to be, but that doesn’t make it true.

3 Likes

Bonjour, tout cela est en effet très intéressant et passionnant, en tout cas sur le papier : en réalité what sont réellement les chances de pouvoir obtenir 6 HOTM en 30 tirages, soit 1 toutes les 5 invocations ? Assurément très peu élevées et pourtant…C’est ce qui m’ est arrivé avec TELLURIA !

Alors, hasard , chance ou probability, peu importe if le jeu est généreux avec vous :wink:

It is definitely possible and since we don’t have any insights we can simply call it luck. But for me it is just interesting to know what are the extents of this “luck”. :slight_smile:

1 Like