Casino Slots Star Card game controller DIAMOND News bingo Banking
What is a Random Number Generator? A Guide to RNG

What is a Random Number Generator? A Guide to RNG

Random number generation is the core of every single game of chance you have ever played. From the shuffling of a deck of cards to the rolling of the dice, to the spinning of slot reels and roulette wheels, the mechanics of randomness are what makes these games fun, exciting, and most of all, almost entirely dependent on luck.

Now, when you’re playing gambling games either with your friends or at a table at a land-based casino, randomness is pretty easy to achieve as everything you’re playing with is done through physical objects. But how do you do the same in a digital game at an online casino?

In this article, we will take a deep dive into the world of game development to learn about random number generation – one of the core components of all of your favourite online casino games.  

Updated by Ralph Trayfalgar

What is RNG?

If you read a few articles on the topic, you will find that RNG as an abbreviation is used to refer to two different things: the general concept and the object that enacts it. 

To clear things up, we will define both: 

For the purposes of this guide, however, we will be using the “RNG” abbreviation here to refer to the actual generators. 

How RNGs Work

Depending on how you want your randomness to be produced, random number generators can come in a huge variety of forms. In the case of online casino games, there are two ways of doing this: mechanically and digitally.

Mechanical RNGs

To start, let’s explain the mechanical means. As the name suggests, this kind of RNG produces a random number at the end of a process that involves manipulating a physical object. If you’ve managed to put two and two together, you will notice that we’ve already given examples of this at the beginning of the article – cards, dice, and the roulette ball and wheel are different kinds of mechanical RNGs.

As an example, a pair of dice produces a random number based on what numbers are on the top faces after the player throws it, as in the case of playing craps. In this case, it is practically impossible to predict what number will actually show on the top faces because of the chaotic nature of where and how the bounce will spin after they land. To induce even more randomness, craps games at casinos will require the player to throw the dice into the opposite wall of the craps table, which is lined with a ridged rubber agitator.

Cards, dice, and the roulette ball and wheel

Digital RNGs

As the name implies, digital random number generators (DRGs) employ lines of code to perform particular mathematical functions in order to generate random numbers. Like their mechanical equivalents, there are several techniques to generate random numbers using software; but, unlike them, explaining how to do so is far more difficult due to the extremely technical nature of the procedure.

The core of it is that the random number generator (RNG) generates numbers that influence the outcome of the casino game. Fortunately, for the majority of people, this is all they really need to know, and they may go on to the next part for additional discussion; but, if you want to know more about the process, we will explain a typical method for random number generation further down in this section.

One of the most common (and simple) methods used by digital RNGs is known as the linear congruential generator or LCG. The LCG is a mathematical algorithm that follows three basic steps:

  1. Define constant numbers A and C, and a modulo number M.
  2. Define a seed number B based on a predefined state.
  3. Compute new random numbers based on the formula (A B + C) mod M.

The most important item to remember about this step is the seed number, which is found in step 2.

A static variable that is either always constant or produced as the application starts up is used as the seed number in the vast majority of implementations of this number generator. Because the seed number is derived from this established state, it is theoretically conceivable to not only know the RNG’s current output, but also to forecast what output will come next if someone obtains the seed number and reverse-engineers the method used to generate it.

And, in fact, this is exactly how it works in the real world. The truth is that the LCG and consequently, the vast majority of RNG algorithms used in computer software, are not genuinely random in the way that they appear to be. Instead, it is what is considered a pseudorandom number generator or PRNG.

Despite the fact that our previous example is rather simple to decipher, a significant amount of software, continue to rely on the LCG to produce randomness due to its simplicity. Of course, no real money casino would ever employ the LCG in the way in which we described above; nevertheless, programmers may increase the unpredictability of the RNG by adding additional layers of randomization to the original algorithm.

This may be accomplished in a variety of ways, the most apparent of which is to make the seed number dynamic rather than a static value. Depending on the circumstances, this could be accomplished in a variety of ways. For example, the likes of Evolution Gaming casinos will use the seed number computed as a result of a math formula performed on the current system time of the online casino’s server, or by using another LCG to generate the seed number based on a different set of inputs (which itself could be generated with another LCG).

Alternatively, one might manipulate the output of the “primary” LCG using further mathematical manipulation to get numbers that are more complicated. And that’s not even taking into consideration the plethora of additional methods that are used to create random numbers.

Digital rngs on online casinos

RNGs and True Randomness

Even with all of the potential complexity that you could incorporate into these RNGs, all of those types of random number generators are still not perfectly random. The reason for this again comes down to the fact that the seed numbers that the algorithms require are themselves not random.

This begs the question: can a random number generator be truly random? 

The short answer is “yes”; but as we will find, there is quite a bit more to this answer in terms of its implications and value. 

As we mentioned earlier, the most vulnerable point of failure for any PRNG is its seed number, so one would want to randomize this as much as possible. Now, since all computer-based ways to generate randomness are inherently non-random, the best way to get input data that is truly random is to get it from the natural world.

One of the most notable examples of this is in the “Wall of Entropy” found in the offices of CloudFlare, one of the world’s largest online content networks. The Wall of Entropy is, simply put, a wall of 100 different lava lamps that are kept on at all times and operate as they normally would. Opposite this wall is an array of cameras that are pointed at each lamp and taking pictures at regular intervals, the data of which is then fed into the CloudFlare systems to generate SSL encryption keys.

Because the movement of the wax blobs in each lava lamp is governed by the chaotic nature of physics, their positions and therefore the data that is encoded into each photo taken of them, is now completely random. 

Now, does it actually matter to have a truly random RNG? For applications like information security (which is what companies like CloudFlare do), randomness is absolutely important to ensure that the encryption keys used to keep the Internet’s data flows secure are impossible to crack.

Gonzo's quest slot game reels view ca
Gonzo’s Quest slot paylines

But for your average Bier Haus or Gonzo’s Quest, true randomness like the methods we have discussed above are completely unnecessary. Most implementations of RNG by slot developers are usually complex enough that it becomes incredibly impractical to beat.

Why are RNGs in casinos important?

As a parallel to the randomness mechanisms in physical gambling games, random number generators are very important to the world of online casinos. More specifically, RNGs are used to simulate the physical act of shuffling cards, rolling dice, or spinning reels in these digital games, which for games of chance, make them pretty consequential. 

In addition to this, however, RNGs are an incredibly important part of online casinos because they also have to be checked and maintained regularly.

When we say “maintain” here, we don’t mean it in the sense of physical components breaking down and needing to be replaced. Instead, random number generators need to be audited to ensure that the games that they run on are not only fun, but also fair. 

RNGs and Fairness in Casinos

Fairness is a difficult concept to really get around in the context of online gambling. The main reason for this is that all casinos, regardless of their size, game selection, or business model, have the same goal of making you lose money over the long run. As the saying goes, “the house always wins in the end”, and this is not only a reference to the inherent design of casino games but also a  reflection of the casino industry in general.  These casino sites do cost money to stay in business, and the only way they can get this money is from player losses. 

For this reason, online casino games have to find and maintain this very delicate balance of gambling fairness in order to retain the trust that gamblers place on them. Too much of a lean towards player wins and the casino leaves money on the table; too much of a lean towards casino revenue would drive away players who might think that the game is rigged.

One of the ways that this fairness is achieved is through audits and certification. This is an optional process in which casino sites invite known third parties that specialise in casino programming to come in and verify the fairness of the code of the games that they host. We will go into further depth on this in a separate guide, but the long and short of it is that verification is generally a nice to have to improve gambler impressions of both the games and the casinos that host them.

Wrap-Up

RNGs are very tightly woven into the fabric of gambling, being the mechanism that gives gambling games their ever-important element of chance. And even in the absence of physical objects, online casino games still require these mechanisms, hence the need for complex RNG algorithms. 

We hope this short guide has been a helpful or otherwise interesting peek into the magic that makes your favourite online casino games happen. Stay tuned to InsideCasino for guides to the best online casinos in Canada.

FAQs

What is casino RNG?

Casino RNG refers to one of many randomness mechanisms that form the basis of modern online casino sites. From security to game fairness, these random number generators are integral to the operation of these sites.

Can you beat RNG?

While it is possible in theory, it is incredibly difficult if not impossible to beat RNG when you try to attempt it. The reasons for this are many and difficult to explain, but the long and short of it is that RNG systems are way too complex to actually try and decode.

What does RNG mean in slot machines?

RNG in slot machines refers to the random number generator in the programming of the slot machine, which is used to create randomness in how much the wheels spin and when they stop.

Is there an algorithm for slot machines?

Yes, there is an algorithm for slot machines which is referred to as the random number generator. This algorithm creates random numbers on the casino’s request, which are then read by the slot machine to determine the outcome of the reel spins.

Can you predict a random number generator?

If you had intimate knowledge of its formulas and input data, you can predict the outcome of a random number generator. In practice, however, the RNG itself is both hidden away and difficult to crack, so it is unlikely for anyone to accurately do the same from the limited perspective of the player.

Play Poker Here

Don’t miss a single bonus

Subscribe to our newsletter and find out first about the safest casinos and games with the best bonuses