Page **1** of **1**

### A bit of bad random gen rage

Posted: **January 30th, 2016, 9:28 am**

by **monocle**

7 easy task failures in a row during combat.

sid mayer's thoughts on randomness, very useful:

https://www.youtube.com/watch?v=bY7aRJE-oOY

### Re: A bit of bad random gen rage

Posted: **February 1st, 2016, 4:12 pm**

by **Nexus**

You know what they say when I play roulette at the casino about the odds of hitting the same number again as the last number?

Technically, the same damn odds as it was to come up last spin!

### Re: A bit of bad random gen rage

Posted: **February 26th, 2016, 5:40 pm**

by **mt1green**

Nexus wrote:You know what they say when I play roulette at the casino about the odds of hitting the same number again as the last number?

Technically, the same damn odds as it was to come up last spin!

Your mixing your statistics. He's saying I have an easy task and failed it 7 times in a row. Not sure what the actual odds are for an easy task. Lets assume its 90% chance success. For those 7 attempts, he should get around 6.3 success. Mind you he can still fail all 7 times, but the probability of that should be pretty low.

What you said if you bet on the same number your chances are still the same, which is correct. 1 in X number on the wheel. With combat/ skill check its a range of number you need like a roll of 10+ on a d20. That percentage is significantly higher.

The issue come with the random number generator. These programs consist of seed # and algorithm used to manipulate the seed. If you know the seed and the algorithm you can determine every number it will generate till a new seed is selected. With poor seed generation or crappy algorithm these programs can really get stuck in number generation. In games like this developers will probably use the generator provided by the engine they use. For us players it can be painful or joyful depending on how the generator sticks. Is it rolling tons of 1s or tons of 20s.

### Re: A bit of bad random gen rage

Posted: **February 26th, 2016, 11:53 pm**

by **kilobug**

Hrm, nowadays you've to really want to screw up to get a broken PRNG. Just use the system's random() function on any POSIX system (or rand() which is slightly less good, but C89), seeded on timestamp at startup and it'll work fine for all non-cryptographic purpose. It won't "get stuck".

The issue can come from two sides :

- how the number is used; rand/random give you an int between 0 and MAXINT, then it's up to the game engine to convert that to a dice roll, apply modifiers, ... and sometimes there is a bug there ;

- the _feeling_ of randomness for humans is very different from maths; in a game you'll roll thousands of dices, so having 7 failure on a row can happen - but it'll feel as a bug, and there are many other similar pyschological effects. Some games actually make their PRNG _less_ random to try to compensate for those issues of the human mind.

### Re: A bit of bad random gen rage

Posted: **February 27th, 2016, 6:23 am**

by **sear**

mt1green wrote:The issue come with the random number generator. These programs consist of seed # and algorithm used to manipulate the seed. If you know the seed and the algorithm you can determine every number it will generate till a new seed is selected. With poor seed generation or crappy algorithm these programs can really get stuck in number generation. In games like this developers will probably use the generator provided by the engine they use. For us players it can be painful or joyful depending on how the generator sticks. Is it rolling tons of 1s or tons of 20s.

I'm not so sure that's what the issue is. I think what is at issue is that humans expect previous random results to bias future ones (even if they logically know this is false):

https://en.wikipedia.org/wiki/Gambler%27s_fallacy
I didn't watch the full video, but I believe what Monocle is proposing (and what Sid and Firaxis have done for years) is fudging the math so that players don't feel cheated when repeated or improbable random numbers lead to their failure (i.e. losing on a 1% failure rate, or failing 3 90% success checks in a row). Though correct me if I'm wrong there.

In general, people are very bad about estimating relative values of random odds. For example, if I tell you "you have a 60% chance to succeed" then you'll probably feel mad or even cheated when you fail, because you assumed that "better than half" odds were near-guaranteed success. Some game developers have been faking (or hiding) numbers from players for years for this very reason.

(For what is worth, some of this is built into or is planned to be built into Torment, i.e. if you have an extremely small move to make to interact with an object or attack an enemy in combat, it won't consume movement for the 1 quarter-step you'd need to take. Other examples include when a DT becomes routine, at which point failure is simply impossible and no roll is even made, even if technically the odds aren't exactly 100%.)

### Re: A bit of bad random gen rage

Posted: **February 27th, 2016, 12:40 pm**

by **mt1green**

sear wrote:mt1green wrote:The issue come with the random number generator. These programs consist of seed # and algorithm used to manipulate the seed. If you know the seed and the algorithm you can determine every number it will generate till a new seed is selected. With poor seed generation or crappy algorithm these programs can really get stuck in number generation. In games like this developers will probably use the generator provided by the engine they use. For us players it can be painful or joyful depending on how the generator sticks. Is it rolling tons of 1s or tons of 20s.

I'm not so sure that's what the issue is. I think what is at issue is that humans expect previous random results to bias future ones (even if they logically know this is false):

https://en.wikipedia.org/wiki/Gambler%27s_fallacy
I didn't watch the full video, but I believe what Monocle is proposing (and what Sid and Firaxis have done for years) is fudging the math so that players don't feel cheated when repeated or improbable random numbers lead to their failure (i.e. losing on a 1% failure rate, or failing 3 90% success checks in a row). Though correct me if I'm wrong there.

In general, people are very bad about estimating relative values of random odds. For example, if I tell you "you have a 60% chance to succeed" then you'll probably feel mad or even cheated when you fail, because you assumed that "better than half" odds were near-guaranteed success. Some game developers have been faking (or hiding) numbers from players for years for this very reason.

(For what is worth, some of this is built into or is planned to be built into Torment, i.e. if you have an extremely small move to make to interact with an object or attack an enemy in combat, it won't consume movement for the 1 quarter-step you'd need to take. Other examples include when a DT becomes routine, at which point failure is simply impossible and no roll is even made, even if technically the odds aren't exactly 100%.)

I understand. I have a degree in Business Information Systems. The degree required two upper class courses on statistics. Statistically I understand that odds are based on 1000s of permutations. What I pointed out, is that no matter how good a computer random number generator is, it's still a mathematical formula, broken down to computer steps. They are generally dependable but can seem very frustrating and depending upon seed/formula cause problems.

### Re: A bit of bad random gen rage

Posted: **February 27th, 2016, 1:28 pm**

by **Firkraag**

So, what you're saying is, that game mechanic rigs the odds and reinforses a bias for the sake of entertainment value? Interesting...

### Re: A bit of bad random gen rage

Posted: **February 29th, 2016, 8:13 pm**

by **tonurics**

mt1green wrote:With poor seed generation or crappy algorithm these programs can really get stuck in number generation. In games like this developers will probably use the generator provided by the engine they use.

I believe the PRNG in Torment is:

xorshift128+ [which is what we used for WL2]; it passes all of the BigCrush tests from the TestU01 suite. V8 recently switched to it, so there's been a lot of

people talking about it.

### Re: A bit of bad random gen rage

Posted: **March 1st, 2016, 1:01 am**

by **kilobug**

tonurics wrote:I believe the PRNG in Torment is:

xorshift128+ [which is what we used for WL2]

If I may ask, why not use the system's (libc) random number generator and re-implement one in the game ? Is there any specific reason for that ? Is it such low quality on some systems or something like that ?

### Re: A bit of bad random gen rage

Posted: **March 1st, 2016, 11:44 am**

by **tonurics**

Something like that: the libc RNG implementation on a player's system is unpredictable; it could be great or it could be awful, it's an unknown. But since the RNG is a very core component, the risk of it simply being "different" is too great. When we balance the gameplay: we want all users to experience the same amount of randomness [or difficulty] as everyone else, regardless of where they are playing. Having a PRNG with a known level of quality allows us to do that and not lose any sleep.