amazing odds

so am I
But RNG isn't really random, as we all know.
There are some bad streaks and some good streaks, which seem to occur a bit too often.

As far as I know, a good RNG is actually very difficult to make (and usually much more difficult than people'd imagine). Most RNGs will exhibit undesired behaviour like "strange" distributions and streaks. Computers don't exactly get a 2^x sided die to use for the generator. Systems like the one where you square a 10 digit number, say, and truncate to get the random number are likely to have weird behavour. So perhaps the calculator is accurate in theory, except the actual RNG is only a very close approximation to what is actually desired. I guess we'll never see the source code for this?

So cabert I think you're probably right. However I'm still tempted to ask you for some evidence of the streaks if they're abnormal. How do you decide how frequent streaks are supposed to be? I do believe you but in my experience I haven't had issues with the RNG.
 
Civ uses Python so I'm guessing they use the Mersenne twister algorithm (Python RNG) which is vastly superior to the C++ rand() functon though (in terms of statistical analysis).

Randomness means strange things happen all the time.
 
I'm just guessing! I pushed for it at our work (games as well), but they uhmmed and ahhed about it becasue it "looked slow". They have no excuse in Civ where it is turn based anyway. I haven't looked at the SDK though, maybe I should.

Mersenne Twister > all other RNGs (to date).
 
As far as I know, a good RNG is actually very difficult to make (and usually much more difficult than people'd imagine). Most RNGs will exhibit undesired behaviour like "strange" distributions and streaks. Computers don't exactly get a 2^x sided die to use for the generator. Systems like the one where you square a 10 digit number, say, and truncate to get the random number are likely to have weird behavour. So perhaps the calculator is accurate in theory, except the actual RNG is only a very close approximation to what is actually desired. I guess we'll never see the source code for this?

So cabert I think you're probably right. However I'm still tempted to ask you for some evidence of the streaks if they're abnormal. How do you decide how frequent streaks are supposed to be? I do believe you but in my experience I haven't had issues with the RNG.


Generally speaking, now a days computer RNG's are good for 'everyday' purposes. Simple ones aren't great for real crazy heavy stuff like calculating how an electron interacts with a complex molecule or lifting a space-ship through a complex gravity field, but for the randomness you need for a computer game you should view them as random.

Back in the 70's, everyone was writing up favorite RNG's and tested through complex tests, but now every basic computer and prgrams like Excel have reasonable ones. The standard tests for randomness back then (sorry, but you young guys probably have passed where we were back then!) were described by Donald Knuth. We used to run RNG's against Knuths 7 tests of randomness. Of course, now everyone has a pretty good one.

Remember, a real random distribution has runs in it -- if a series has NO runs, its not random.

Breunor
 
Yeah, but rand() is still rubbish (sepscially if you take the low order bits). And I don't think it was Knuth that invented the randomness tests, talented though he was.
 
Civ uses Python so I'm guessing they use the Mersenne twister algorithm (Python RNG) which is vastly superior to the C++ rand() functon though (in terms of statistical analysis).
The Mersenne twister algorithm is written in C, so it would be very weird to use Python to access it from the DLL.
 
All Python intrinsic functions are wriiten in C. What it doesn't do though is call rand(), which is dodgy.
 
They don't use rand(), neither the Mersenne twister, but their own implementation. Which seems to be a bit dodgy as well to me (but I don't know much about random number generation), but doesn't show any anti-human bias ;)
 
Basically the function they use is:

Code:
#define MAX_UNSIGNED_SHORT                  (0xffff)

#define RANDOM_A      (1103515245)
#define RANDOM_C      (12345)
#define RANDOM_SHIFT  (16)

unsigned short get(unsigned short usNum)
{
	m_ulRandomSeed = ((RANDOM_A * m_ulRandomSeed) + RANDOM_C);

	unsigned short us = ((unsigned short)((((m_ulRandomSeed >> RANDOM_SHIFT) & MAX_UNSIGNED_SHORT) * ((unsigned long)usNum)) / (MAX_UNSIGNED_SHORT + 1)));

	return us;
}

It's kind of hard to find how m_ulRandomSeed is first seeded, might happen in the engine and not in the dll.
 
Ooh that's rand(). tut tut. No wonder people are feeling ripped off by the RNG :). They should have used the Python version ;)
 
Yeah, but rand() is still rubbish (sepscially if you take the low order bits). And I don't think it was Knuth that invented the randomness tests, talented though he was.

Nah, randomness tests were around for hundreds of years. But at least in the early days of computers (I mean the 70's, not the 50's!), people used his tests for randomness.

As I said, I wouldn't be surprised if people moved on.

Breunor
 
It seems this issue of probability is really just a matter of perspective. If you lose a unit at 90% odds, you feel ripped off but you brush it off as bad luck. If you lose several units at 90% odds in one game, you feel really pissed. If you lose several units at 90% odds in several games, you are steaming mad and feel the Gods are against you. Either that or you are really unlucky, which is possible.

If I hand you a gun with 10 chambers and put a bullet in just 1 chamber and ask you to play Russian roulette, you say no way Jose. Why not, you have 90% odds of living! You might have worse odds driving in your car over the next year, statistically speaking. But to you, 10% odds of dying is a lousy deal and I agree. So if you want to use a well-promoted unit with 90% odds next time in a battle, you might think twice because it means he has 10% chance of not living to fight another day.

On an unrelated topic: if a worker chops a forest outside your cultural boundaries, does it make a sound? discuss.
 
Look, as a poker player, I know what it's like to have incredibly good odds thrown back in your face. And so do my opponents. Story #1. I was playing a tournament with friends, pulled Q-J. Raised. One opponent calls. flop comes 47J. I raise. Opponent reraises. I go all in. What did he have? Aces. turn comes 9. River? Queen. Point is, the only reason I remember that is because of the incredibly good odds I started with (Not knowing my opponents hand, top pair averages 70 or so %), then the very slim odds my opponent had me beat, and followed by the very bad odds of me pulling a queen. Ask me about any time i pull a hand like that and my opponent loses, I won't remember a thing. When we win 70% battles, it doesn't stick in our minds. When we lose several, it does. It's just really bad luck. Story #2. I hit my opponent Roosevelts one remaining unit on his final city, a rifleman, twice with infantry. Odds were 80.7 and something like 75.9. Both of my infantry die. My opponent sees this, declares war and on that turn takes the city. I feel ripped off. odds were something like 2.5%, but it still happens. That's why they're called odds. Story #3 and moral of the story. Poker tournament online. I in the top 70%, but blinds are catching up to me fast. I get 9,9. I go all in. One person calls. He has K-10. Flop- 6K7. Turn-2. River- 9. I double up, less than 10 turns later i get knocked out. Point is, it happens to the computer/other players too. Shake it off, it's just a game. No offense. All stories in this were true, I might have mixed up numbers and cards, but the general stories are true.
:lol: :mad: :lol:-:cry:
 
I might have to give up Civ for online poker...

... it's much cooler talking about flops and the river than arguing about specialist economy ;)
 
I might have to give up Civ for online poker...

... it's much cooler talking about flops and the river than arguing about specialist economy ;)

Yea, I like to use poker stories and analogies. It's a lot easier and simpler than speaking of complex calculus algorithms. X-Y23.R /B.A68 (random numbers and variables) is a lot harder to follow than 7J4 holding QJ, all in one caller with rockets, comes 9Q. I play both civ and online poker. Then again, I have a lot of spare time. :)
 
If you have odds of 99/100, and run a hundred billion tests, at some point you'll lose 100 times in a row. This is true whether you have a terrible RNG or a superb RNG. Hence the quality of the random number generator is fairly academic IMO. It's not worth implementing a really meaty RNG system for a meaningless PC game. If Civ was an online poker game, then yep. But a leisurely TBS? Why bother?
 
Back
Top Bottom