# Number - Pseudo-random Numbers

> (Data|State) Management and Processing > (Data Type|Data Structure) > Number, Numeric, Quantity

### Table of Contents

## 1 - About

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)

## 2 - Articles Related

## 3 - 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 |

## 4 - 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.

### 4.1 - 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.

## 5 - Demo

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