Aardvark
Chieftain
Does anyone know what PRNG Civ uses? Even what type would be helpful. Some types of PRNG are more likely to have long strings of similar numbers.
I'm too lazy to do a search, but I beleive you. The reason why people think random numbers should not be "stringy" is because they forget that each trial is independent and generalize the rules of infinite sets to finite ones.Padma said:If you do a search, you will find that the PRNG used by Civ3 has been demonstrated to be *very* accurate at representing true random numbers. People have a tendency to think random numbers should not be "stringy", when, in actuality, they can be very much so.
That is completely false. Please see my previous post.Bungus said:I think its pretty much established the Civ RNG has a tendency towards strings. If it was deciding the outcome of a coin flip, for example, and it lands heads, its more likely to land heads next time. But it hits tails sooner or later, and then its more likely to see more tails, so it balances out in the long run. But not very good at being random.
public class Random {
public int seed = 0;
public int rnd() {
seed = seed * 1103515245 + 12345;
return ((seed >> 16) & 0x7FFF);
}
}
Now if you're saying this "coin flip" RGN is good solely because on a long enought time-line the number of heads and tails are equal, that is false. You should not be more likely to see tails after tails has come up, or vise versa. That would create strings, but when heads finally comes up, the strings would be reversed in heads favor. This would, with a large enough sample, show equal chances of heads vs. tails. But if the previous outcome effects previous ones, well, that would make for a bad (predictable) RNG.Brain said:That is completely false. Please see my previous post.
The seed value is stored in the save file. I looked at how it changed and tried to find a pattern. After some investigation I concluded that the number 12345 was central and made a google search including that number and the correct algorithm popped up.Bungus said:By the way, how do you reverse engineer Civ's PRGN without the source code?