# Number - Pseudo-random Numbers

Pseudo-random numbers is a sequence of numbers that is predictable if you know the seed. Because true randomness is unpredictable, this is called pseudo randomness (If you know the seed, you can predict the output)

A pseudo-random sequence has the following properties:

• The sequence should never repeat itself
• The numbers should be spread evenly across the numeric domain (for instance between 0 and 10)

## Example of bad random sequence

Type Sequence Example
Uniform sequence 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Repeated sequence 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Too many low numbers 1 3 2 5 3 9 1 2 4 2 5 1 1 2 8 1 5 2 3 4
Too many even numbers 2 8 4 6 0 9 8 2 4 8 6 4 2 2 5 1 4 8 6 2

## Generator

This sequence is generated through a random generator that requires a seed value. For the same seed value, you will get the same sequence of Pseudo-random Number.

Random number generators are pseudo-random number generators because the output of a deterministic program cannot really be random. They are complex because they are deterministic programs that must give the illusion of being non-deterministic.

A random generator may be considered high-quality for simulation while being considered unacceptable for cryptography.

### With Distribution

A frequent problem in statistical simulations (the Monte Carlo method) is the generation of pseudo-random numbers that are distributed in a given way. Most algorithms are based on a pseudorandom number generator that produces numbers X that are uniformly distributed in the interval [0,1]. These random variates X are then transformed via some algorithm to create a new random variate having the required probability distribution.

## Demo

The below graphic was generated with Javascript. Click on the “Try the code” to see the code.

• A helper function to draw an histogram
• Creating the population data randomly distributed
• Building and getting the bins
• Getting the bin
• The HTML page

## Tools

### Openssl rand

openssl rand 1)

openssl rand -hex 16


Discover More
Cryptography - Nonce (Number Only used once)

In cryptography, a nonce is an arbitrary number that can only be used once. A value that is used only once. It is similar in spirit to a nonce word, hence the name. It is often a random or pseudo-random...
Number - Random (Stochastic|Independent) or (Balanced)

Think of randomness as a lack of pattern. Something random should be unpredictable. We shouldn’t be able to predict the next value of the sequence The degree to which a system has no pattern is known...
Pseudo-Randomness - Seed

The seed is the start point in the generation of pseudo-random numbers. The random seed is any valid 32-bit integer. Every unique seed value results in the same sequence. Even the tiniest change...
Statistics - Central limit theorem (CLT)

The Central_limit_theoremcentral limit theorem (CLT) is a probability theorem (unofficial sovereign) It establishes that when: random variables (independent) (estimate of a random process) are added...
What is a UUID - Universally Unique IDentifier - (also known as GUID) ?

UUID (Universally or Global Unique IDentifier) are generated identifiers that are guaranteed to be unique and avoid collision