## RNG produces proper distribution. But that isn't everything

**Moderators:** Forum Moderators, Developers

### Re: RNG produces proper distribution. But that isn't everyth

Not sure what you mean by that. Hypergeometric distribution is a probability distribution, the linear congruential generator is an algorithm.Is there any chance to get option in MP lobby "RNG mode" with options: "Modified linear congruential", "Hyperheometric"?

### Re: RNG produces proper distribution. But that isn't everyth

Okay. I will try to say it in other way.lipk wrote: Not sure what you mean by that. Hypergeometric distribution is a probability distribution, the linear congruential generator is an algorithm.

I believe what main reason behind this topic is "Wesnoth RNG is unfair". Nobody cares about math until it gets hurts.

Hypergeometric distribution is a very "fair" way to modify RNG. Of course noone will going to change all game to allow it.

So I think it is a good idea to give a choice to user: whether he wants to use "fair" random or "unfair". This choice should be shared and visible for all players -> make an option in MP lobby (create new game dialog).

### Re: RNG produces proper distribution. But that isn't everyth

That is what I don't understand. Do you want the random generated numbers to follow hypergeometric distribution? No offense, but that's just plain silly. Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that. To illustrate the problem imagine the following: let's assume that the RNG produces numbers between 1-100. If the generated numbers follow a uniform distribution, all 100 numbers have exactly the same chance to appear. As a result you have the double chance to get a number between 1-80 than between 1-40. Now imagine that the RNG produces some different distribution, soHypergeometric distribution is a very "fair" way to modify RNG.

*not all numbers have the same chance to be generated*. For example, let's say that it generates only numbers smaller than 10 or bigger than 90. Now what? The chances of getting a number between 1-80 are

*exactly the same*as getting one between 1-40. Is that better? Surely not. This applies to any probability distribution other than uniform, since those all have more and less "favored" atomic events.

### Re: RNG produces proper distribution. But that isn't everyth

Wesnoth is not cryptographical system. It is a game.lipk wrote:Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that.

Only reason behind HGD is to make feel what unit have (for example) 60% chance to hit, not to make 60% of all of this attacks being hit.

### Re: RNG produces proper distribution. But that isn't everyth

That's not cryptography, it's high school mathematics Maybe I wasn't clear enough, though. 30% hit chance means that the RNG spits a number smaller than 30. Naturally, you'd expect 60% to be exactly twice that chance. However, if the generator doesn't produce uniform distribution,xudojnik wrote:Wesnoth is not cryptographical system. It is a game.lipk wrote:Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that.

*that will not be the case.*60% chance won't be 30%*2. You think you could settle the complaints this way?

What you have a point in is that people may feel that the RNG is unfair at times, but unlike you, I don't believe that it's the machine's fault. In my opinion, it's simple psychology; people just interpret the numbers in a wrong way. 60% is a synonym of "ideal circumstances", although it's barely more than half-half chance to hit or miss (in case of two attacks, the most probable scenario is one hit). I suspect that in many people's mind 70% is equal to "sure hit", despite it means only two out of three.

And of course you still haven't explained how would your suggestion help matters...

### Re: RNG produces proper distribution. But that isn't everyth

i'm a bit confused...

you want a 60% CTH not mean that the unit has 60% chances to hit, but a higher chance so people feel the RNG is more fair ???

i'm confused... we don't lie, we say you have 60% chances, and you do have 60% chances to hit. if you feel you unit doesn't hit enough you need to increase its CTH, and that's a MP balance problem, not a coding problem.

If we change the RNG to not be linear, the whole game balance needs to be redone...

you want a 60% CTH not mean that the unit has 60% chances to hit, but a higher chance so people feel the RNG is more fair ???

i'm confused... we don't lie, we say you have 60% chances, and you do have 60% chances to hit. if you feel you unit doesn't hit enough you need to increase its CTH, and that's a MP balance problem, not a coding problem.

If we change the RNG to not be linear, the whole game balance needs to be redone...

Fight key loggers: write some perl using vim

### Re: RNG produces proper distribution. But that isn't everyth

Have you ever read about hypergeometric distribution?

It not about increasing chance to hit. It is about providing reliable chance to hit, which will stay same regardless of number of draws.

Now situation much different. You can get "good luck" and hit unit with 70% of defence 3/3 times , or you can get "bad luck" and miss 3/3 times with mage.

It not about increasing chance to hit. It is about providing reliable chance to hit, which will stay same regardless of number of draws.

Now situation much different. You can get "good luck" and hit unit with 70% of defence 3/3 times , or you can get "bad luck" and miss 3/3 times with mage.

### Re: RNG produces proper distribution. But that isn't everyth

And if you provide "reliable chance to hit", the probability of missing 3/3 times with a mage would no longer be 2.7%, but lower than that, or even 0% depending on what exactly you're suggesting.xudojnik wrote:It not about increasing chance to hit. It is about providing reliable chance to hit, which will stay same regardless of number of draws.

Now situation much different. You can get "good luck" and hit unit with 70% of defence 3/3 times , or you can get "bad luck" and miss 3/3 times with mage.

Currently, you constantly face situations where you have to consider the risk of missing 3/3 with a mage (or similar), and have to choose whether to take the risk or find a safer alternative. If what you're suggesting means that the probability of your mage missing 3/3 would be decreased, then it most certainly is about increasing chance to hit.

### Re: RNG produces proper distribution. But that isn't everyth

I suppose you intend something like the warcraft3 chance-to-hit system, which shifts the *probabilities* (not the numbers) depending on how long the unit's miss streak is. (and works out to approximately the same overall number of hits, so the initial chance to hit must be lower than stated)

### Re: RNG produces proper distribution. But that isn't everyth

You are right. I proposed exactly this.AI wrote:I suppose you intend something like the warcraft3 chance-to-hit system

This link was in my first post of this thread, but who cares.

### Re: RNG produces proper distribution. But that isn't everyth

If the author had not written on the blog first and had his preferred RNG been introduced silently into Wesnoth or another game, he might have noticed that the complaints about the RNG would have remained exactly the same. Or if it were introduced with announcement soon you would have people complaining that the new one is even worse. Isn't it telling, that people are jumping on a blogpost, that asks for better randomness, with their usual request for less randomness (i.e. shorter streaks than would be expected in a random distribution)? Also, it might be quite interesting to give the number how many random numbers are involved in the "simple tests" that reveal the flaw of the Wesnoth RNG as compared to the number of random numbers generated in the collected games of Rigor (for example). To me it is quite obvious that confirmation bias is a force several magnitudes larger than any flaws.

I am a Saurian Skirmisher: I'm a real pest, especially at night.

- AxalaraFlame
**Posts:**690**Joined:**December 4th, 2011, 1:07 pm**Location:**Pasadina, Caltech

### Re: RNG produces proper distribution. But that isn't everyth

Find it. It is called "irrationaire", written by sauron. It is a good idea of introducing warcraft3 RNG, I would say. However, Dave's preferences of a game founded upon pure probability calculation also has nice advantages. But "luck management" could hardly be explained and taught to the players; they could only learn it themselves, so I would prefer to settle down the expected damage within a satisfactory range.

### Re: RNG produces proper distribution. But that isn't everyth

Reminder: The topic of this thread is Does Wesnoth use a "Linear Congruential RNG", and if so, is there a problem with its sequences not having enough randomness. The topic is not how much influence should Luck have in Wesnoth.

(This reminder is mostly directed at xudojnik)

**Failure to stay on the topic will result in your posts being split into a separate topic or deleted**.(This reminder is mostly directed at xudojnik)

http://www.wesnoth.org/wiki/User:Sapient

*... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."*