Gears and Wheels

By Mike in Hawaii

Bear with me for a moment.

In World War II the Germans created a cipher machine. It
was very German. It was a thing of mechanical beauty and awe-inspiring. It
consisted of a number of interlocking geared wheels with scrambled wires and
contacts and even a further patch panel where you could change even more of
its wiring. Every time you pressed a key to encrypt a letter, the machine
moved and re-wired itself before the next letter.

The average human looking at this thing and its impressive
statistics on how many key presses it would take before it would repeat itself
with a given cipher key setting, and being shown its inner workings, would be
dumfounded. It made the average mind implode with its complexity and beauty.
Each time you pressed a wheel, it performed like a flea circus act.

It was certainly a masterful mechanical random number
generator applied to the problem of encrypting text messages in an unbreakably
sophisticated fashion.

But there were three things wrong with this picture and
that proved to be very important.

**First, it was a machine.** After all was said and done
it was gears and wheels. Machines are predictable. They cannot be otherwise.

**Second, it was used by humans.** Humans are very
predictable, and error prone. They make mistakes. Such as sending out a long
encrypted message and then realizing they used yesterday’s cipher key and
immediately re-sending it re-encrypted with today’s cipher key before their
supervisor catches them. This does not sound like much, but this is the sort
of mistake that in the right hands gets a lot of people killed.

**Third, it was not being watched by ordinary people, but
by geniuses.** People so smart in their unique way they needed special
handling, almost like mental patients. They lived in an alternate universe and
saw things others could not see. They did things with math no one had ever
dreamed of before.

Between it being a machine, and thus predictable, having
its mechanical purity contaminated by human error and being watched by special
people who only needed a tiny clue, it failed. Even worse, the Germans could
not imagine it could fail, so they kept on using it. Even as evidence mounted
that it had been compromised. They blamed the security leaks on everything
else but the machine. It was inconceivable this masterpiece was compromised.

**Ah, so what does this have to do with Craps, and gambling?**

**Anything we are interested in?**

Gambling and random numbers or random events are heavily
interlocked. If an outcome were predictable, then gambling ceases to be
gambling.

Gambling is very illegal in Hawaii, some of the most
draconian anti-gambling laws in the nation; make it one of two anti-gambling
super states.

Still I ran Chess Tournaments for surprisingly large
amounts of cash, where each entrant would buy in, play the tournament and then
the prize money would be distributed out based on a pay table for first,
second and third etc.

Sound familiar? Very much like a Texas Hold’em tournament
at Binions.

The difference is that while poker is still considered a
random game of chance, and thus gambling, chess is considered a game of skill
and therefore not gambling. One can argue over that, and indeed many do allege
that poker is a game of skill, just like chess, and thus should not be
gambling, legal or illegal. But poker does include a randomizer, the shuffle
and deal of the cards. Chess does not. So a line gets drawn.

Any mechanical action such as shuffling cards, turning a
roulette wheel, throwing dice, are all subject to random number failures which
have been exploited by shrewd gamblers and followed by upgrades in Casinos to
improve the chances that such things are done more randomly. A modern super
card shuffler is an example.

The above WWII example and Casinos come together at this
point. Especially today, more and more of the randomization at Casinos are
being done by RNG’s or Random Number Generators.

**How random is it Johnny?**

Good question. There are two basic problems. Generating
random numbers and testing random numbers to see if they are really random.
Both are amazingly difficult.

It is a bit like the surprising problem in optics. While it
is not that hard to grind a very precise mirror or even a lens in your
basement for a home-made telescope, grinding an optical flat, a piece of glass
that is extremely flat across its entire surface, is tremendously difficult
and demanding.

We talk about a series of numbers being “white” as in white
noise. We are not talking about prejudice here, just the opposite. We are
talking about all possible outcomes being generated with exactly the same
expectation. If we take an alleged random number generator and collect enough
sample numbers from it, we ought to be able to see it produce each possible
outcome the correct percentage of the time.

So if the outcomes are either 1 or 2, heads or tails, odd
or even, then we would expect it to produce one half the time, and two half
the time. The problem is how many trials do we need? Oh boy, that nails it. A
lot of trials as it turns out.

Are we going to be happy with plus or minus 1% confidence?
If we get 51% of one and 49% of the other are we going to be happy?

Probably not. 1% is a fair percentage of the house
advantage in many games. The only way to test it to a higher precision is to
collect more trials.

Here is the big rub. If we collected 1,000 trials of two
equally likely outcomes, say heads and tails, and decided we need more
precision, more confidence, in order to double our confidence in the results
we have to square the number of trials.

To double our confidence we would not need 2,000 trials. We
would need 1,000,000 trials. (Gasp!). [He must be making this up.]

To increase confidence ten-fold or one stinking decimal
place, we would need many more trials collected. Wait for it…

You need 1,000 raised to the tenth power, which is the size
of number normally used only by astronomers. Short version, this gets out of
hand very fast.

It gets worse. When you throw dice, there are not two
outcomes, there are 36. As the number of outcomes increases the number of
required trials to get each to have something approximating the right answer
(for number of occurrences of each) goes way up also. So 1,000 may not be
enough to even get you started. I find for 36 outcomes “sensible” starts at
about 1 million trials.

So along comes someone with their “Super Incredible Reverse
Big Red and Double Up on Sevens with Two Place Bets on the Dark Side
Guaranteed Gold System for Massive Profits at Craps.”

How do you test it? First you are up against 36 possible
outcomes on each roll of the dice, and then you are up against the complex
mechanics of the betting system, which introduces even more possible tree
branches and multiplies the total outcomes. Quickly you get to where millions
of trials are required to even start to get 1% confidence in any of the
numbers generated.

All assuming you could generate the quality random numbers
in the first place. At the very core of such a test would be a random number
generator. If it is defective, everything else is defective.

**Garbage In = Garbage Out (as we like to say).**

But, put lipstick on that pig, make a full color Pie Chart,
load it into PowerPoint, which is the greatest mass hypnosis tool ever
invented, and you can sell that bacon as pure gold. And you can have the
“math” to “prove” it.

How? Well any sensible number of trials is going to produce
data that is of such low confidence that each test run’s output will change
significantly and scatter results all over the place. Just keep doing it until
you eventually get the “answer” you want.

The number of trials to actually prove it would be huge and
you would need a very good random number generator. The number of trials to
accidentally get the “correct” answer is not large at all. In fact it is
easier with fewer trials. Just pick some number like 5,000 that the average
Joe is going to imagine is a large number for this purpose.

If you just want “an answer” that matches your allegation
by accident, you can just keep testing until the “right” one pops out.
Enshrine that Crap (pun) in Excel and work a lot on the color graphics for the
PowerPoint presentation of your “proof”. Suddenly the proper selection of
colors for psychological impact is more important than your stinking garbage
data, with one of those Christmas tree car deodorizers as optional equipment.

Now we come back to it. Any computer software random number
generator is NOT random! Period! End of discussion.

It is a machine, well an emulation of a machine, with
virtual gears and wheels. They are correctly called pseudo-random number
generators. True, a good one takes a long time to repeat and is relatively
“white” over a very long sample, but it is still a pattern generator. True the
very best ones are “close enough for Government work”, or your local ATM.

#
Is Anything Really Random?

There are few things that are considered actually “random”.
Probably the best of these is radioactive decay. If you have a radioisotope
and you watch it with a detector such as perhaps a Geiger counter, there is no
way currently known which can predict when the next “click”, the next
radioactive decay, is going to happen.

So you might take a pseudo-random software random number
generator of high quality and run it very fast all the time, locked on. Hook
it to a Geiger Counter contaminated by some radioisotope so it clicks a lot,
and each time it clicks, grab the output at that instant of the pseudo-random
number generator. The random clicks “encrypt” the output of the pseudo-random
number generator a second time. The result is about as good as we know how to
make a string of true random numbers.

Too esoteric? Not really. Ever heard of slot machines?

Modern ones do exactly this, but instead of a radioactive
Geiger counter they use the human player. They run their pseudo-random number
generators very fast and wait for a pull on the handle. The instant they
detect a pull, they grab whatever number is up next.

The outcome is now certain. All the spinning wheels, real
or simulated, or whatever other motion and flashing needs to be done is just a
little show, a few seconds of entertainment for the player before revealing
the answer.

The human does the final “encrypting” because they cannot
pull a handle reproducibly compared to the speed of the clock on the
pseudo-random number generator running inside the slot machine, or video poker
machine, or whatever.

There are even websites which crank out random numbers
based on this procedure, clocked a second time by the arrival of cosmic rays
or decaying radioactive sources. So a high quality set of random numbers can
be obtained for all the testing that needs to be done with them.

But even after your random numbers are “in order”; there is
no getting around the number of trials required. Or the fact that number goes
up very fast with the number of possible outcomes.

Or the real killer, what is needed to increase confidence
in the answer generated. Just one silly decimal point, going from a confidence
of a lousy 1% to something potentially useful like 0.1% takes not ten times as
many trials. It takes however many trials you got 1% confidence with raised to
the tenth power.

#
Opps, a Fly in the Ointment!

Let’s look at a specific case. You are playing poker
online. Let’s assume it is a decent website with every reason to expect it is
free of tampering, well run and as legitimate as playing in a top of the line
casino. You get four of a kind, Jacks. The very next hand you get four of a
kind, Nines. What is going on!

When you take a data set, a number of trials that is way
too small, normal statistics are right out the window. If you are looking at
only about 100 poker hands, that number compared to what would be required to
produce “proper statistical distribution of hands” is so invisibly small, that
you might capture outrageous variations from statistical chance. Such as back
to back four of a kind hands. Or 100 hands with no pair, zip, high card only,
all 100 of them.

Your first reaction in the above case might be to think
there is something wrong with the random number generator. In fact in the old
days of DOS it had a random number generator that stank so bad in its BASIC
that any attempt to create a game with it was laughable. Now days even
software pseudo-random number generators can be very good. My personal
favorite is the DES encryption run in cipher feedback mode.

But we still have to deal with what I call God Math (with a
capital M) [To Infinity and Beyond!] and real world pedestrian math, lower
case.

Any time we participate in a gambling session the one thing
we can count on is that our sample, our personal number of trials, will be
tiny compared to what is needed to see distributions of results anywhere near
those fancy statistics to many decimal places which God Math can crank out for
an infinity of trials.

So while statistics may say that four of a kind is a very
rare hand, with a small sample it is a bit like earthquake prediction. If
someone gets up every morning and predicts there will be an earthquake in Los
Angeles today, there will inevitably come a day when he is unfortunately
right.

I played limit Hold’em at the Bellagio. I had a pocket
pair, but I figured someone would raise before the flop so I just called. Sure
enough, about four seats down, someone raised. So I re-raised and he raised
again to the limit. The flop came 10, 10, Ace, and I just checked. He bet and
I raised. He re-raised and I raised again.

Everyone else got very far out of the way. We were
obviously both sure what was going on. He had pocket Aces and had a full house
with Aces over tens. He figured that I had Ace/10 and held tens over Aces and
he had me way over a barrel. We both had what I call “Titanic” hands. There is
no getting away from them. Someone is going down with the ship.

I had two pair, both tens. At the Turn card we bet and
raised each other to the limit. At the River we bet and raised each other to
the limit. He threw down his pocket Aces so hard they bounced on the felt and
the dealer was half way through pushing over the chips when I carefully turned
over my cards face up for the dealer to see. The dealer did a double take and
slowly raked back all those chips and shoved them over to me. One player
confused asked, “What’s going on?” Another player answered, “Four of a kind”.
Where is a bad beat jackpot when a table needs one?

As little as I get to play, something like that should
never have happened in my lifetime. To get four of a kind **AND** the
perfect setup where any novice could cash in to the limit of the law is rare
indeed.

Trying to prove something by collecting trials is tricky.
The number of trials needed to make a sensible and believable statement is
nearly always quite large. The results from a sensible number of trials are
almost certain to be garbage.

As the complexity of what is being tested goes up, the
number of trials needed goes up as well, quickly surpassing anything humanly
possible. By the time you take the 36 ways dice can fall, add a bunch of if
then else statements on top of that to simulate even a relatively simple
betting system, and even using a decent pseudo-random number generator, a
computer is going to have to crank on it for a very long time to get anything
believable.

This is where Monte Carlo testing falls down. At the number
of trials required to get the results to settle down to a useable accuracy and
precision.

Going at it the other way, attempting to use God Math to
calculate the value of a Craps betting system to infinity and beyond, can be
very daunting with all its paths and branches, probabilities for each branch
and so forth, coupled with the changing rules for the come out and the chasing
points phase. If you can do it, without error, double-checked and checked
again, then you have something as we say “suitable for framing”.

But ultimately to prove that something works you need to
generate good data. Good data needs to have less noise than the required
accuracy needed for proof. If you need to prove something is happening 51% of
the time plus or minus 0.1%, the noise in the data needs to be reduced to less
than 0.1%. Or you need to do it not with trials and Monte Carlo simulations,
but with God Math where answers can be obtained to any required number of
decimal places. Sometimes that is easy to set up. Other times it can be quit
difficult.

Sometimes you cannot create a computerized Monte Carlo
version at all. Take precision dice shooting or dice influencing. By its very
nature a human has to throw the dice and he or she can only throw so many
times in a row, so many times per minute. There is a sharp limit on how many
trials can be collected. And it is WAY too few! So we can argue about dice
control until the cows come home.

For me I took another approach. I reasoned out how dice
control could work at the physical level and proved to myself that the skill
involved was learnable. I even calculated what would be the result on the
bottom line if various amounts of control were possible. Reaching the point
where I consider it something every Craps player should do. Learn to shoot the
dice correctly, consistently, calmly and with control. There is a chance it
will make a difference and it certainly is going to help you keep your head in
the game.

Beyond that, I don’t think anyone will ever prove
scientifically that they can control the dice in a legal fashion to a useful
and reproducible extent. So I am happy to take it on faith.

But when someone announces they threw the dice several
hundred times and got an abnormal amount of Sevens or whatever, my reaction is
“so what?”

I would be far more interested in watching someone quickly
produce a beautiful controlled, smooth throw several hundred times in a row.
That I would believe in.

#
So What Can Be Said?

In any gambling session the one thing you can count on is
that you will see so few trials that the statistics will almost certainly be
skewed, possibly dramatically.

Four of a kind, twice, back to back is just the sort of
thing that will happen to someone. More importantly, anyone who will sit still
long enough is going to hear about it. You don’t hear about the hundreds of
thousands of times it did not happen to other people.

Statistics calculated to three decimal places are fun to
know and tell. Just don’t be surprised if the “impossible” happens. Be it four
the hard way eight out of ten throws in a row, four of a kind back to back,
two royal flushes on a video poker in a single hour or someone holding the
dice for an hour and a half.

The reaction should not be “What are the odds against
that!” it should be “That was bound to happen somewhere to someone and I got
to see it!”

If lightning did not strike occasionally gambling would be
a lot less fun.

Oh, yes, beware of anyone misusing lipstick…