Unrandom generator. Is there any way around this?

Sduibek

Creator of Fallout Fixt
Moderator
Modder
As we all know, randomness (or more accurately, "pseudo-randomness", for the math nerds amongst us) is at the core of games such as Fallout.

Sometimes in the error logs, you'll see something like this:

Fallout error.log said:
Fade time is 253
Fade steps are 166
Chi squared is 41.747500, P = 36.420000 at 0.05
Warning! Sequence is NOT random, 95% confidence.
Initializing sound system...soundInit: Setting primary buffer to: 16 bit, 2 channels, 22050 rate
soundInit: Primary buffer settings set to: 16 bit, 2 channels, 22050 rate
success.

I assume there's no way to force an exception for randomness in such situations? Maybe rolling a new seed or something. I don't know if this applies to Fallout 2 as well as Fallout 1 but I don't see why it wouldn't.

I think this is possibly beyond even the powers of Mash and Timeslip but I figured it's worth asking.
 
Actually, replacing the random number generator would be fairly easy. But...
Sduibek said:
95% confidence.
As you've noticed, fallout does a check of its random number generator at each startup. If this check indicates the numbers are not random with at least 95% confidence, it leaves that little message in the log file.

Now count how many times you've started fallout up in total. I bet it's rather more than 20. The way the check works, you would expect to see that message show up one time in 20 (i.e. 5% of the time) even if the random number generator is perfect in every way. This is why science has the concept of a repeatable experiment. (And why most reports of interesting results in the media where something has happened with 99% certainty are complete crap.)

Unless you're getting that message significantly more than 1 time in 20, you have nothing to worry about.
 
Timeslip said:
(And why most reports of interesting results in the media where something has happened with 99% certainty are complete crap.)
I assume you're referring to that statistically it is possible to have confidence of 99% of the displayed margin of error, which they rarely do. Statistics class was fascinating to me :D So like if it's a Gallup poll or whatever, it should actually say this:

"We're 95% sure that the values shown here are within +/- 4.4% of the actual values". They usually provide the +/-4%, but the other percentage is extremely important, because if for example they only called 600 people, yes a 95% confidence is high, but if you're talking a population of ~300+ million, only 95% confidence that the stated variance of +/-4.4% is accurate, could make for pretty big differences when applied from sample to population.

Timeslip said:
Unless you're getting that message significantly more than 1 time in 20, you have nothing to worry about.
Nah, I have some code in my little helper program that I wrote in C#, that renames and copies debug.log every time the game is run or exited. Out of ~1400 log copies, there's only about 15 that have the randomness error shown :P

Interestingly, about half of them are from a 20-minute window on one specific day, so it's definitely using the system clock (seconds, ticks, whatever) for generation. That was apparently a bad day for randomness, literally. ;)

Thanks for your reply.

-

Sidequestion, how would you go about replacing it? I mean if it's using the clock as a seed, and that seed is "not sufficient for randomness-generation", how would you seed it differently? I don't know enough about seeding to have any idea what any alternative would be.
 
Sduibek said:
Interestingly, about half of them are from a 20-minute window on one specific day, so it's definitely using the system clock (seconds, ticks, whatever) for generation. That was apparently a bad day for randomness, literally. ;)
I'm surprised the initial seed has that sort of effect, (similar seeds shouldn't result in similar sequences,) but since I don't know what random number generator fallout uses I can't really comment.

To replace it with a different algorithm using sfall, you only need to override fallout's rand() function with a custom one and do whatever seeding needed to be done seperately at sfall init time. You wouldn't have to modify any of fallout's seeding stuff, you can just let it go off and set up its own generator safe in the kowledge it will never get used.
 
If it is that simple, maybe a basic copy-paste from other GPL projects might help. I think the easiest would be take two of them as helper functions, one rather simple and one rahter complex (i.e., slower, so it should be avoided if possible); if the simpler one gives a non-random situation, then you run the more complex one, calling them from the new rand() function. Just tossing out an idea.
 
Back
Top