fodev.net
15.08.2009 - 23.06.2013
"Wasteland is harsh"
Home Forum Help Login Register
  • November 23, 2024, 08:12:10 pm
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Play WikiBoy BugTracker Developer's blog
Pages: [1]

Author Topic: What is used for Random generator/function in the game?  (Read 1625 times)

What is used for Random generator/function in the game?
« on: November 15, 2011, 06:45:41 pm »

I have noticed the following when playing the game:
I have 49% percent hit chance to hit the rat with the knuckles, so when I attack I would expect some sequence like this (1 - hit, 0 - miss):
0 0 1 0 1 0 0 1 1 0 1 ... some random mixture of 1 and 0
But in reality what i see is something like this
0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 ... all hits and misses go in chunks instead of being randomly distributed.

In other way it feels like 49% hit chance produces sequence of events which looks like this
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 (less random)
instead of like
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 (more random).
Same feels with crits with 66% chance it goes like either chunk of misses or chunk of crit hits, but almost never one miss , one hit.

Have any one else noticed something similar or is it just my perception of the rolls?
Logged

Wallace

  • "Not a bug. It's a feature"
  • Offline
Re: What is used for Random generator/function in the game?
« Reply #1 on: November 15, 2011, 07:24:20 pm »

A few friends of mine was trying to make a random number generator once... and it wasn't an easy task

So no wonder that "random" chance in FO has some glitches...

(so yeah... i noticed that too)
Logged

craft, Craft, CRAFT! (armors)
sometimes repair dismantle stuff
Roleplay!
...and most of all; DEATH TO NERFING!!!
Re: What is used for Random generator/function in the game?
« Reply #2 on: November 15, 2011, 07:50:53 pm »

It is easy to make a good pseudo-random generator using http://en.wikipedia.org/wiki/Linear_feedback_shift_register with a huge period. However that will eat more CPU than typical C++ *rand(). :/
Logged

Atom

  • Rotator
  • Offline
Re: What is used for Random generator/function in the game?
« Reply #3 on: November 16, 2011, 01:57:30 am »

To answer the question: Mersenne Twister, which is far better than any commonly found linear congruence based pseudorandom generator. It passes all but the most cutthroat of the randomness tests used for determining "goodness" of a given generator. A sequence of 10 or so numbers is not going to change that.

Discussions of the "random is broken" kind appear in any game where chances are known to the players, because sooner or later someone stumbles upon some abnormal sequence that allegedly "proves" that something is wrong with the game's generator. It has to happen, because if a random sequence is large enough, one will always find a small chunk that exhibits some kind of a pattern. Watching a sequence long enough will produce such chunks of arbitrary length, with arbitrary pattern. It's what statistics say. Or Ramsey theory, in a much broader sense. Once the human mind is set on registering such abnormal sequences, it will start to ignore much of the relevant data that, when examined, could easily dispel the illusion.

In some cases, such complaints even lead to efforts by developers to rig the random generator so that it won't produce abnormal sequences at all (for instance: for rolls with 95% chance, it would never produce two failures in a row). This works as far as fooling the human perception is concerned, but frankly, it is done by derandomizing a random. A recent example of such tampering with otherwise good RNG is Civilization V. It's not even a secret.

The best way of dealing with such topics is requesting thorough statistical tests over at least several hundred of rolls. Taking samples of this size under scrunity invariably reveals the random generator to actually work good. To spare the effort:
http://pastebin.com/VdseVhSt (1000 times Random(1,100))
Feel free to apply any statistical tests over this sample. And share the results.
Logged
Pages: [1]
 

Page created in 0.073 seconds with 22 queries.