Acronym Advice - RNG

  • RNG for the uninitiated

    There are a lot of acronyms in the world of gaming and I am going to write a few posts to help try and clear them up for you.

    (A little bit of background) I am by day a Secondary School Teacher in charge of the Computer Science department. We teach Computer Science to all ages from 11 through to 18, with a GCSE course and A Level course in the subject.

    So let’s start with RNG – or Random Number Generator

    Random Number Generator – Dice Rolls

    A random number generator is a cornerstone of most videogames in some form or another. Like rolling a dice in a game of Monopoly, there needs to be a seemingly random way in which the user is provided with things in a game:

    • Cards in a game of Solitaire
    • Mine positions in Minesweeper
    • Lottery Numbers with a “lucky dip” ticket
    • Health and Statistics for a new character in an RPG
    • What chest is dug up in Sea of Thieves

    But how do they work? How do we get a machine, that is based on logic and runs on sequences of set, strict instructions to produce a seemingly random number?...

    Use the System Clock – Pseudo-Random Numbers

    Yes… one of the very basic versions of a random number generator is to use a simple algorithm that pulls the milliseconds from your system clock to convert into a “random” number. This number is called a seed, with a mathematical calculation than applied to it to generate a number that is seemingly random.

    In programming languages such as python you could generate a simple random number from 1 to 10 like this:
    random = random.randint(1,10)
    Now if you were to run this code in quick succession to generate, say 10 numbers as I just have, the list looks like this: 3, 3, 3, 10, 6, 10, 6, 4, 5, 6… Hardly very random, but this is because I generated them in a fraction of a second!
    These are what we call ”Pseudo-Random” because there is a real world influence in their generation – such as the time from the system clock.

    Further Reading

    Using simple pseudo-random numbers works for most games, depending on the seed number of course and the source, but sometimes you need something a little more refined.

    Programs can use all manner of other physical external sources, such as mouse movements, key stroke input times and even link to websites across the world that take atomic decay rates as a seed!

    These generate numbers that are known as ”True-Random” because the seed that developed them cannot be easily repeated in the real world (such as the number of milliseconds in a second.

    If you want to read more, I suggest these articles to help you out:

    For now though – happy voyaging – let’s hope that RNG is favourable to you!

    (part 2 can be found here)

1
Posts
1.6k
Views
1 out of 1