# Random Numbers

Learn about random numbers with the help of interactive examples in this lesson.

## We'll cover the following

## What are random numbers?

There are several scientific works on random number generation. Think about this: A computer is something deterministic, so how can it generate random numbers? Most of the personal computers from the last century were generating pseudo-random numbers and after these computers were restarted, these numbers remained the same. So, games such as “Sea Battle” were always predictable, because playerswould already know the “random” locations of the ships.

The explanation for this behavior is straightforward: computers should rely on random data, and there are no ways to get this random data. However, in modern operating systems, random number generators consider numerous parameters, such as delays between pressed keys, mouse movements, network events, and so on. All of this information is collected from the real world and serves as the foundation for random number algorithms.

But what if this information is not enough? What if we wanted to just turn on our computer, make a couple of mouse movements, and get the sequence of billions of random numbers? The vector of random numbers is defined by random information obtained from the real world. Therefore, how many vectors can we have?

It looks like we can have quite a lot of vectors, but things are a bit different in the real world. Here is a real-life example of this. One online poker website published code for shuffling cards. They wanted to be transparent with their players about how their software works, and the algorithm looked like this:

```
for i := 1 to 52 do begin
r := random(52) + 1;
swap := card[r];
card[r] := card[i];
card[i] := swap;
end;
```

Get hands-on with 1200+ tech skills courses.