# Random Number Generator (RNG)

## How does random number generator (RNG) work?

**Random number generator** (**RNG**) takes count, start and end input fields, and **generate numbers** in a range that you defined. Parse and Stringify result options available.

## What is a random number generator?

A Random Number Generator (RNG) is a mathematical construct, either computational or as a hardware device that is designed to generate a random set of numbers that should not display any distinguishable patterns in their appearance or generation, hence the word random.

There are two main types of random number generators: true random and pseudorandom.

## What is a true random number generator?

A **true random number generator** (TRNG) cannot rely on mathematical equations and computational algorithms to get a random number because if there is an equation involved, then it is not random. In order to get true randomness, a device must collect entropy from the natural environment to measure such as atmospheric and thermal noise and other quantum and electromagnetic phenomena. An example of a random number generator is a device that measures radio noise and then extracts that value and presents it to the user or application. Other sources of entropy include subatomic physical phenomenon such as radioactive decay whose unpredictability and randomness can be explained by laws of quantum mechanics.

Applications that benefit from true randomness are games such as those related to gambling like bingo, card games, the lottery and similar games. Video games that emphasize random loot collection also benefit from true randomness, as pseudorandom number generation can lead to frustration since it can go a long time without the target number being hit or the same number can be obtained repeatedly.

## What is a pseudorandom number generator?

Software-generated random numbers are typically pseudorandom. Likewise, our Random Number Generator is also **pseudorandom number generator**.

Pseudorandom Number Generator (PRNG) refers to an algorithm that uses mathematical formulas to produce sequences of random numbers. PRNGs generate a sequence of numbers approximating the properties of random numbers.

A PRNG starts from an arbitrary starting state using a **seed state**. Many numbers are generated in a short time and can also be reproduced later, if the starting point in the sequence is known. Hence, the numbers are deterministic and efficient.

## Why do we need RNG?

With the advent of computers, programmers recognized the need for a means of introducing randomness into a computer program. However, surprising as it may seem, it is difficult to get a computer to do something by chance as computer follows the given instructions blindly and is therefore completely predictable. It is not possible to generate truly random numbers from deterministic thing like computers so PRNG is a technique developed to generate random numbers using a computer.

## Applications of RNG

The random numbers are widely used in digital games.

They are also used in statistical sampling.

They can be seen in cryptography, computations in statistical physics.

They are widely used in casino games like roulette wheel.

Also used in radio communications.

In addition, they are used for numerical analysis.