Training and consultancy for testing laboratories.

Posts tagged ‘Randomization’

A short note on Excel Random function RAND()


The MS Excel® “=RAND( )” function is one of the two commonly used to generate a random decimal number from zero to one in an Excel cell. Another one is “=RANDBETWEEN( )”, which generates a random integer in the range specified. Read on …. A note on Excel Random function


Sampling randomization – Part II


In selecting random samples for analysis, it is necessary to generate random numbers.  Random numbers also are used for simulations and can be used to create sample datasets.   Random numbers can be generated in a number of different ways ……

Randomization – Part II

Sampling randomization – Part I


We have been talking about the importance of carrying out random sampling for laboratory analysis.  What is actually randomization?

Randomization – Part I

Ensuring your random sampling process is really random


How to ensure your simple random sampling is really random

The Law of Averages and slot machines

Jackpot on slot machine. Three-dimensional image. 3d

This blog does not encourage the reader to gamble in casino but highlights the statistical and probability reasoning in the casino games which are largely governed by the Law of Averages, for general interest.

When you are in a casino for a good time, remember a simple guideline that the easier a game is to understand, the worse the odds usually are against you. This is certainly the case with slot machines.

There is no skills demanded in playing the slot game to improve your odds as long as you know where to press a button to set the machine reels in motion. Every spin is independent of all past spins. It means that for a given machine game, the odds are always the same as the outcome of every spin is ultimately determined by the programmed random number generators in the machine. It makes no difference when the last jackpot was hit or how much the game paid out in the last hour, day or any period of time.

Indeed, slot machines like some other casino games are a type of game for which there is no winning strategy for you to apply. The outcome is already predestined the moment you press the GO button and the odds are totally unknown to the players like you as these odds are not quantifiable.  Unlike a blackjack game against real opponents, for example, you may have proper application of skill or strategies to make a game profitable in the long term, such as distraction and intimation to make the casino dealers losing concentration and making mistakes in the games.

In case of slots, you encounter a high house edge (the profit margin can be 2-5% or so arbitrarily set by the casinos) and fast turnaround time of play, as compared with other casino games. There is no way to make money in the long term. The Law of Averages ultimately will let the casino win.

However many people tend to enjoy the thrill of such a game in casinos even if they know or merely suspect that is a negative equity investment of their money because of the house edge (profit margin for the house).

So the interesting question is: Why play since we know there is always a house edge?  Of course, there is always a chance that you may get lucky in the session to hit the jackpot or some good returns. You may also find playing slots can be a cheap form of entertainment if you faithfully stick to a budget and are disciplined enough to quit when the target of making or losing a certain set percentage of your bankroll.

An advice from experts is that you should not be too ambitious in the goals, such as aiming to stay until doubling your bankroll.  More modest aims have more chance of being achieved, say 50% of your bankroll. Do not fall for any absurd belief about ‘riding my luck’ if you reach your target early.  Take your money and run before the beast of randomness wakes and consumes all your cash.

Let’s look at an example of a hypothetical simplified slot machine with three reels and ten fruit symbols on each reel. And, there is only one pay-out, the “Jackpot”, for matching three same fruit symbols in a row and you need to match three of the same to win the jackpot on this $1 machine.

So the chance of hitting, say a banana symbol on one reel is 1/10 and the chance of hitting a banana on the second reel is also 1/10. Therefore the chance of hitting three bananas in a row is 1/10 x 1/10 x 1/10 or 1/1000, or 0.010%. The chance looks bleak but your odds of winning are actually better than this because you can also hit any one of nine other sets of fruit symbols. So on this machine, your odds of any set of three identical symbols are actually 10 x 0.10% or 0.10%. Therefore theoretically once in every 100/0.10 or 1000 spins of this hypothetical machine, you will hit your set of three identical symbols for the jackpot.

If the jackpot payout is $ 1000, the machine would be a break-even proposition as on average you would put up the $1 bet for 999 times without winning anything, and then you’d hit once in the 1000th spin for the $1000 prize, breaking even overall.  Pay-outs are usually set by the casinos at a slightly lower figure, usually between 95% and 98% of this frequency, so for example if this imaginary machine is set for 95% pay-outs, the jackpot would actually be $950, instead. .

Of course, you can be very lucky and hit jackpot on your second spin to walk away with the $950 prize, technically making a hefty profit for $2 bets.  But on long-term speaking, there is no way to beat the Law of Averages and the house edge will be sustained over any short-term variance in results.

At this point, an important fact must be realized. That is randomness usually takes time to reveal itself.

Tossing a coin a few times, it is not surprising to get all heads or all tails, suggesting the coin is not behaving randomly at all although we expect it to be.  By keeping going, the fact that there are two possible outcomes (heads and tails) will become increasingly clear. This is symptomatic of what statistician calls the ‘asymptotic’ nature of the Law of Averages, i.e. what it says about relative frequencies only strictly applies to very large (towards infinity under the Law of Large Numbers) sequence of events. For any finite sequence, a whole range of possibilities is consistent with randomness, and it can be radically different from the long-term average for really short sequences.

When this idea is applied to casino games, this means that during short sessions one can get some pretty hefty departures from the house edge, or profit margin, and if that house edge is very thin to start with, the results can be a burst of profitability for players. The shortest of short sessions can be a single day play or so.  While even such short sessions would not necessarily turn the odds in your favor, it does minimizes the time you are exposed to the Law of Averages.

Robert Matthews, one of Britain’s successful science writers advises in his book “Changing It” that the best for players is to seek out games with the smallest house edge and play long enough to stand a good chance of coming out ahead, but not so long that the Law of Averages starts to make itself felt.

His another advice is to avoid slot machines and lottery games where eye-popping jackpots are funded by eye-popping house edges.  Instead, focus on simple bets on roulette (such as red/black), or learn how to play and exploit the low-edge bets in games like blackjack and craps.

Next, decide how much time and money you can afford in the casino, and play until one or the other has run out. Lastly, do not spend your time making lots of little bets, as that reduces your chances of coming out ahead.

The trick to having a good time in casino is to turn up the discipline, tone down your ambition, and cut your losses sooner rather than later!



Is rolling a die completely random in casinos?

Is rolling a die completely random in casinos?


When we have a standard and fair six-sided die, we believe the odds of rolling a particular number are 1/6 as there is an equal probability of rolling each of the numbers 1 – 6.  But, will the number 1 (and all the other five numbers) come up one-sixth of the time as predicted?  We know that if someone rolls a die, the initial force on the die, the topography over which the die is travelling and the laws of physics are going to affect the final results.  Is it possible, at least in theory anyway, for us to predict its outcome and benefit from an advantage of it?

The potential monetary gains have drawn gamblers in the world’s casinos to make all sorts of dice throwing methods in order to solve this tempting problem.

In casinos around the world, there is a popular game called “Casino Craps” or “Bank Craps”. It is played on a purpose-built table and two dice are used for the game. These dice are made even with very high standard quality and are routinely inspected for any damage during the throwing. As a matter of course, the dice are replaced with new ones after about eight hours of use to maintain their fairness. Also casinos have implemented rules in the way a player handles them. Why would they do this?

A story goes that in the middle of the 20th century, a gambler spent a good deal of time developing a manner of throwing the dice in which they spun frantically but did not tumble.  By using this method, the gambler had managed to achieve good outcome but the results were so profitable that the gambler was finally banned from entering casinos.

Today, a rule in playing the Crabs game requires that the shooter (the player) must handle the dice with one hand only when throwing, and the dice must hit the walls on the opposite end of the table. The wall at that opposite end contains numerous bumps that presumably randomize the outcome of the throw!

Hence, gamblers are advised to leave their chance of winning to randomness behavior of the dice on a carps table and accept the odds gracefully..

Sampling strategies – Part III


Sampling strategies – Part II


Sampling strategies – Part I


R techniques in generating random numbers