WEBVTT
Kind: captions
Language: en

00:00:00.000 --> 00:00:01.760
- At the Lumiere Place Casino in St. Louis,

00:00:01.760 --> 00:00:04.640
a man holds his
phone up to a slot machine

00:00:04.640 --> 00:00:07.520
and he records the spins on the screen.

00:00:07.520 --> 00:00:08.960
He played a few rounds.

00:00:08.960 --> 00:00:13.120
He won some, lost some, and
then he got up and walked away.

00:00:13.120 --> 00:00:16.640
Five minutes later, he was
back playing the same machine,

00:00:16.640 --> 00:00:21.920
but now he was winning on spin after spin.

00:00:21.920 --> 00:00:24.400
After less than an hour
of gambling, he walked out

00:00:24.400 --> 00:00:28.240
of the casino roughly $10,000 richer.

00:00:28.240 --> 00:00:31.200
At least 10 casinos
across Missouri, Illinois,

00:00:31.200 --> 00:00:33.520
and California saw the same thing.

00:00:33.520 --> 00:00:35.680
Gamblers would play on a
slot machine for a while

00:00:35.680 --> 00:00:38.400
and then leave, and minutes
later, they would return

00:00:38.400 --> 00:00:40.800
and start winning.

00:00:40.800 --> 00:00:42.240
Investigators were brought in,

00:00:42.240 --> 00:00:44.320
but when they examined the slot machines,

00:00:44.320 --> 00:00:46.880
they all seemed to be working fine.

00:00:46.880 --> 00:00:49.840
So they turned their attention
to the security footage

00:00:49.840 --> 00:00:52.320
and they noticed something strange.

00:00:52.320 --> 00:00:53.840
When these players came back,

00:00:53.840 --> 00:00:56.000
they didn't play like normal gamblers.

00:00:56.000 --> 00:01:00.000
They'd hover their hand
over the spin button, wait,

00:01:00.000 --> 00:01:03.920
and then press at oddly specific moments,

00:01:03.920 --> 00:01:07.200
as if they knew when to press to win.

00:01:07.200 --> 00:01:08.480
And maybe that makes sense.

00:01:08.480 --> 00:01:11.040
Perhaps there's some way to
predict what was coming next

00:01:11.040 --> 00:01:12.400
because the outcomes

00:01:12.400 --> 00:01:14.800
of those spinning wheels
are actually decided

00:01:14.800 --> 00:01:17.040
by a computer inside the machine.

00:01:17.040 --> 00:01:19.040
Now, gambling is a terrible idea,

00:01:19.040 --> 00:01:21.360
but the casino provides an ideal venue

00:01:21.360 --> 00:01:23.280
for investigating randomness

00:01:23.280 --> 00:01:26.240
because theoretically,
that computer uses a

00:01:26.240 --> 00:01:28.000
random number for every spin.

00:01:28.000 --> 00:01:30.880
So are those numbers actually random?

00:01:30.880 --> 00:01:33.760
Well, that seemingly
simple question turns out

00:01:33.760 --> 00:01:37.120
to connect finding diamonds in
Minecraft to the development

00:01:37.120 --> 00:01:39.760
of the first nuclear
weapons to the security

00:01:39.760 --> 00:01:42.240
of the entire digital world.

00:01:42.800 --> 00:01:45.280
This is a video about
the near impossibility

00:01:45.280 --> 00:01:49.360
of creating true randomness.

00:01:49.360 --> 00:01:51.840
Back in the 1940s, physicists discovered

00:01:51.840 --> 00:01:54.640
that chance plays a
surprisingly important role in

00:01:54.640 --> 00:01:57.040
what happens inside a nuclear bomb.

00:01:57.040 --> 00:02:01.760
It works something like this.
Take a core of uranium-235.

00:02:01.760 --> 00:02:06.400
When a neutron hits a U-235
nucleus, it can cause the nucleus

00:02:06.400 --> 00:02:09.200
to split, which releases
energy and around two

00:02:09.200 --> 00:02:10.800
or three more neutrons.

00:02:10.800 --> 00:02:14.880
Now, if on average each split
triggers more than one more

00:02:14.880 --> 00:02:19.280
split, you get a runaway chain reaction.

00:02:19.280 --> 00:02:21.920
But whether that happens
depends on the path

00:02:21.920 --> 00:02:23.840
those neutrons take.

00:02:23.840 --> 00:02:26.560
How far does each one travel
before it hits a nucleus

00:02:26.560 --> 00:02:28.960
or does it bounce off or get absorbed

00:02:28.960 --> 00:02:31.520
or does it cause another to split?

00:02:31.520 --> 00:02:32.880
By 1945,

00:02:32.880 --> 00:02:35.680
scientists working at Los
Alamos had measured the odds

00:02:35.680 --> 00:02:38.080
of each of these events happening,

00:02:38.080 --> 00:02:41.840
but those odds changed depending
on things like the neutron's

00:02:41.840 --> 00:02:43.600
speed and what it was passing through.

00:02:43.600 --> 00:02:45.120
And across trillions

00:02:45.120 --> 00:02:47.120
and trillions of neutrons,

00:02:47.120 --> 00:02:48.720
there were far too many possibilities

00:02:48.720 --> 00:02:51.440
to calculate one by one.

00:02:51.440 --> 00:02:53.600
One of the mathematicians
working on this problem

00:02:53.600 --> 00:02:55.520
was Stanisław Ulam.

00:02:55.520 --> 00:02:59.920
But then one morning in
January 1946, Ulam woke up

00:02:59.920 --> 00:03:01.680
and couldn't speak.

00:03:01.680 --> 00:03:03.120
It was encephalitis

00:03:03.120 --> 00:03:06.000
an inflammation of the
brain that nearly killed him.

00:03:06.000 --> 00:03:09.280
Luckily he survived, but
his recovery was slow.

00:03:09.280 --> 00:03:13.360
So he spent weeks in a hospital
playing a lot of solitaire

00:03:13.360 --> 00:03:16.080
and he started to wonder
what are the chances

00:03:16.080 --> 00:03:18.720
of winning a game?

00:03:18.720 --> 00:03:21.200
Now, at first, that might
sound like a simple question,

00:03:21.200 --> 00:03:25.680
but a deck of 52 cards can be
shuffled in 52 factorial ways,

00:03:25.680 --> 00:03:27.680
and that's about eight
times 10 to the power

00:03:27.680 --> 00:03:30.240
of 67 different arrangements.

00:03:30.240 --> 00:03:31.200
And every one of those

00:03:31.200 --> 00:03:33.040
shuffles is going to play out differently.

00:03:33.040 --> 00:03:36.400
Now, Ulam spent a lot of time
trying to work out the answer

00:03:36.400 --> 00:03:39.520
to his question analytically
and he got nowhere.

00:03:39.520 --> 00:03:42.240
But then he had a much simpler idea.

00:03:42.240 --> 00:03:45.600
I wondered whether a more
practical method might not be

00:03:45.600 --> 00:03:49.120
to lay it out, say, 100
times and simply observe

00:03:49.120 --> 00:03:52.400
and count the number of successful plays.

00:03:52.400 --> 00:03:53.600
That would give him some sort

00:03:53.600 --> 00:03:56.240
of statistical
approximation of the answer.

00:03:56.240 --> 00:03:58.800
So say you win eight
games out of a hundred,

00:03:58.800 --> 00:04:00.400
well then your overall chances

00:04:00.400 --> 00:04:03.680
of winning are probably around 8%.

00:04:03.680 --> 00:04:06.800
And that's when Ulam realized
he could use exactly the same

00:04:06.800 --> 00:04:08.240
idea, but for neutrons.

00:04:08.240 --> 00:04:11.200
So instead of trying to
calculate every possible path,

00:04:11.200 --> 00:04:13.440
he could just start
with a hundred neutrons

00:04:13.440 --> 00:04:15.280
and use random numbers to simulate

00:04:15.280 --> 00:04:16.960
what would happen to each of them.

00:04:16.960 --> 00:04:18.720
So say a neutron hits an atom.

00:04:18.720 --> 00:04:20.720
If I roll a one, a two,

00:04:20.720 --> 00:04:22.960
or a three, it bounces off the nucleus.

00:04:22.960 --> 00:04:26.640
If I roll a four or a five, it
causes the nucleus to split.

00:04:26.640 --> 00:04:29.360
And if I roll a six, it gets absorbed.

00:04:29.360 --> 00:04:31.920
And then I just follow what
happens to that neutron

00:04:31.920 --> 00:04:33.120
and any other neutrons

00:04:33.120 --> 00:04:35.440
that it produces using more random numbers

00:04:35.440 --> 00:04:36.960
and that will decide their fate.

00:04:36.960 --> 00:04:38.720
Now those are just example odds.

00:04:38.720 --> 00:04:41.360
In the real simulations, the
scientists used probabilities

00:04:41.360 --> 00:04:42.480
they had already measured

00:04:42.480 --> 00:04:44.320
to decide which random numbers

00:04:44.320 --> 00:04:46.320
corresponded to which outcomes.

00:04:46.320 --> 00:04:48.800
And after each interaction,
the neutron's speed

00:04:48.800 --> 00:04:50.560
or direction could also change.

00:04:50.560 --> 00:04:53.120
So for the next step, they
used the probabilities

00:04:53.120 --> 00:04:54.560
for its new situation.

00:04:54.560 --> 00:04:56.400
So use another random number

00:04:56.400 --> 00:04:58.640
and then they kept
following what happened.

00:04:58.640 --> 00:05:00.960
And by repeating this
process, they could see

00:05:00.960 --> 00:05:03.680
how all those interactions added up.

00:05:03.680 --> 00:05:05.840
If the number of neutrons keeps growing,

00:05:05.840 --> 00:05:08.640
the chain reaction takes off.

00:05:08.640 --> 00:05:12.320
But if more are lost than
are produced, it fizzles out.

00:05:12.320 --> 00:05:16.400
So by simulating just a tiny
fraction of the possible paths

00:05:16.400 --> 00:05:18.560
could estimate how an entire nuclear chain

00:05:18.560 --> 00:05:20.480
reaction would behave.

00:05:21.280 --> 00:05:22.960
But doing all of these calculations

00:05:22.960 --> 00:05:25.040
by hand seemed impossible.

00:05:25.040 --> 00:05:26.560
Luckily, fellow mathematician

00:05:26.560 --> 00:05:29.760
and Los Alamos advisor, John
von Neumann, had been working

00:05:29.760 --> 00:05:31.840
with one of the world's first electronic

00:05:31.840 --> 00:05:33.840
computers, the ENIAC.

00:05:33.840 --> 00:05:36.160
In March 1947, he worked out

00:05:36.160 --> 00:05:38.080
how it could follow 100 neutrons

00:05:38.080 --> 00:05:40.160
and their descendants through thousands

00:05:40.160 --> 00:05:43.200
of collisions in just five hours.

00:05:43.200 --> 00:05:45.840
But the ENIAC couldn't
roll a die to decide

00:05:45.840 --> 00:05:47.280
what would happen to a neutron.

00:05:47.280 --> 00:05:50.480
At the time, when researchers
needed random numbers,

00:05:50.480 --> 00:05:53.840
they used books of random
digits like this one.

00:05:53.840 --> 00:05:57.040
And the ENIAC didn't
have nearly enough memory

00:05:57.040 --> 00:06:00.000
to store all the random
numbers it would need either.

00:06:00.000 --> 00:06:02.800
So von Neumann came up with
a surprisingly simple way

00:06:02.800 --> 00:06:07.120
for the ENIAC to generate
its own random numbers.

00:06:07.120 --> 00:06:08.640
Let's say I want to generate a bunch

00:06:08.640 --> 00:06:10.480
of random four digit numbers.

00:06:10.480 --> 00:06:12.480
So the way we're going to do
this is I'm actually going

00:06:12.480 --> 00:06:14.720
to start by choosing one,
which is called the seed.

00:06:14.720 --> 00:06:19.280
So let's try with 2,137.

00:06:19.280 --> 00:06:21.280
So what I'm going to do next is square it

00:06:21.280 --> 00:06:23.760
and 2,137 squared is

00:06:23.760 --> 00:06:29.280
4,566,769.

00:06:29.280 --> 00:06:32.480
Now I'm going to take the four
middle digits of this number,

00:06:32.480 --> 00:06:35.040
but to do that first, I have
to add a zero to the front

00:06:35.040 --> 00:06:38.000
because we initially had
a seven digit number.

00:06:38.000 --> 00:06:39.760
I won't use the digits at the edges

00:06:39.760 --> 00:06:41.360
because they're actually more predictable.

00:06:41.360 --> 00:06:45.120
So the last two digits only
depend on the end of the seed

00:06:45.120 --> 00:06:49.120
because 37 squared ends in 1,369.

00:06:49.120 --> 00:06:54.160
So anything ending in 37 squares
to something ending in 69.

00:06:54.160 --> 00:06:56.640
So that's why we get
rid of these guys here.

00:06:56.640 --> 00:07:00.000
Also, every seed in the
2,100s is going to square

00:07:00.000 --> 00:07:03.200
to somewhere between 4.4 and 4.9 million.

00:07:03.200 --> 00:07:04.640
So they all start with a zero

00:07:04.640 --> 00:07:06.880
and a four, so we can get rid of that too.

00:07:06.880 --> 00:07:09.040
But the middle digits
get a contribution from

00:07:09.040 --> 00:07:10.480
every digit in the seed.

00:07:10.480 --> 00:07:15.280
So 5,667 is going to be the
next number in the sequence.

00:07:15.280 --> 00:07:17.200
So if we square that, we get

00:07:17.200 --> 00:07:23.200
32,114,889.

00:07:23.200 --> 00:07:26.320
Now I disregard the two digits at either

00:07:26.320 --> 00:07:32.960
end, and you can just keep going.

00:07:32.960 --> 00:07:35.760
Looking at these numbers,
there's no obvious pattern,

00:07:35.760 --> 00:07:37.840
but watch what happens if I keep going.

00:07:37.840 --> 00:07:40.560
Starting from 2,137,

00:07:40.560 --> 00:07:44.400
after 43 steps, I get 4,100,

00:07:44.400 --> 00:07:48.720
then 8,100, and then 6,100,

00:07:48.720 --> 00:07:52.640
and then 2,100, and then 4,100 again.

00:07:52.640 --> 00:07:55.440
The sequence gets stuck in this loop.

00:07:55.440 --> 00:07:58.240
From here on, the generator
will produce these same four

00:07:58.240 --> 00:08:00.720
numbers over and over forever,

00:08:00.720 --> 00:08:02.160
and nearly two-thirds

00:08:02.160 --> 00:08:06.800
of all four-digit seeds
end up in this exact loop.

00:08:08.400 --> 00:08:09.600
Others end up at zero,

00:08:09.600 --> 00:08:14.000
and once they do, every number
that follows is also zero.

00:08:14.000 --> 00:08:19.440
Almost one in five starting
values end up here.

00:08:19.440 --> 00:08:22.400
In fact, if you try every
possible four-digit starting

00:08:22.400 --> 00:08:25.920
value, every single sequence
eventually gets stuck in one

00:08:25.920 --> 00:08:28.640
of just eight traps.

00:08:28.640 --> 00:08:29.840
Now, von Neumann knew

00:08:29.840 --> 00:08:31.600
that these traps were a serious problem.

00:08:31.600 --> 00:08:33.200
So for the first ENIAC simulation,

00:08:33.200 --> 00:08:36.320
the team actually used
eight-digit numbers, not four,

00:08:36.320 --> 00:08:39.680
so they produced much longer
sequences before they looped.

00:08:39.680 --> 00:08:42.400
They also statistically
tested the first 2,000 numbers

00:08:42.400 --> 00:08:44.000
for randomness by hand,

00:08:44.000 --> 00:08:47.120
then rather than risk running
into an unexpected loop,

00:08:47.120 --> 00:08:50.400
they programmed the ENIAC to
restart from the original seed

00:08:50.400 --> 00:08:53.440
after it had got through
these 2,000 numbers.

00:08:53.440 --> 00:08:55.600
And in the spring of 1948,

00:08:55.600 --> 00:08:59.200
the ENIAC finally ran the
first computerized simulations

00:08:59.200 --> 00:09:00.880
of neutron behavior.

00:09:00.880 --> 00:09:04.160
Von Neumann wrote to Ulam,
"The results are very promising

00:09:04.160 --> 00:09:08.400
and the method is clearly a 100% success."

00:09:08.400 --> 00:09:11.760
The approach became known as
the Monte Carlo Method named

00:09:11.760 --> 00:09:13.280
after Monte Carlo, Monaco,

00:09:13.280 --> 00:09:15.520
where Ulam's uncle liked to gamble.

00:09:15.520 --> 00:09:18.640
Today, it's one of the most
important tools in statistics

00:09:18.640 --> 00:09:21.600
and scientific computing.

00:09:21.600 --> 00:09:24.800
Now, this sequence of
numbers isn't truly random.

00:09:24.800 --> 00:09:26.640
If you start with the same seed,

00:09:26.640 --> 00:09:29.520
you get exactly the same
sequence every time.

00:09:29.520 --> 00:09:32.080
So they're called pseudorandom numbers,

00:09:32.080 --> 00:09:34.720
but that didn't actually
stop them from being useful.

00:09:34.720 --> 00:09:37.680
As Monte Carlo spread beyond Los Alamos,

00:09:37.680 --> 00:09:40.400
so did this demand for
pseudorandom numbers.

00:09:40.400 --> 00:09:42.480
Still, as von Neumann joked, anyone

00:09:42.480 --> 00:09:44.160
who considers arithmetical methods

00:09:44.160 --> 00:09:48.640
of producing random digits is
of course in a state of sin.

00:09:48.640 --> 00:09:50.320
Because pseudorandom numbers came

00:09:50.320 --> 00:09:52.480
with three major challenges.

00:09:52.480 --> 00:09:56.160
One, sequences could get
stuck in these short loops.

00:09:56.160 --> 00:10:00.000
Two, even sequences that looked
random could hide patterns.

00:10:00.000 --> 00:10:02.080
And three, if someone knew the seed,

00:10:02.080 --> 00:10:04.400
they could work out every
number that followed.

00:10:04.400 --> 00:10:08.080
They were predictable. So
you, you got to show me

00:10:08.080 --> 00:10:09.600
how we get these diamonds then.

00:10:09.600 --> 00:10:11.600
- Yeah. All right.

00:10:11.600 --> 00:10:14.560
- This is Matthew Bolan, Minecraft expert

00:10:14.560 --> 00:10:17.280
and third year PhD student
in mathematics at the

00:10:17.280 --> 00:10:19.200
University of Toronto.

00:10:19.200 --> 00:10:22.320
Well, I shall follow you,
sir. If you haven't played

00:10:22.320 --> 00:10:25.120
Minecraft before, diamonds are a big deal.

00:10:25.120 --> 00:10:27.800
I don't know if I've ever
made a full diamond set.

00:10:27.800 --> 00:10:29.600
- We're going to change that today.

00:10:29.600 --> 00:10:33.280
- Every Minecraft world
is made up of chunks.

00:10:33.280 --> 00:10:36.800
They're segments 16 blocks
wide in the X direction

00:10:36.800 --> 00:10:39.360
and 16 blocks in the Z direction.

00:10:39.360 --> 00:10:43.920
And in our version, each chunk
originates at most a single

00:10:43.920 --> 00:10:45.120
vein of diamond ore

00:10:45.120 --> 00:10:48.720
that is hidden somewhere
below the surface.

00:10:48.720 --> 00:10:50.560
Okay. So what are we looking for?

00:10:50.560 --> 00:10:55.120
- So we are looking
for either a clay patch

00:10:55.120 --> 00:10:57.680
or a gravel patch.

00:10:57.680 --> 00:11:00.240
What you do is you pull up your F3 screen,

00:11:00.240 --> 00:11:05.760
you locate which direction is positive Z.

00:11:05.760 --> 00:11:07.600
So in this case, that's this way.

00:11:07.600 --> 00:11:12.080
- Yeah.
- And what you do for clay, you add three.

00:11:12.080 --> 00:11:13.520
So here, this was the center,

00:11:13.520 --> 00:11:17.600
and we go one, two,
three in the positive Z.

00:11:17.600 --> 00:11:20.400
And now, if we dig down here,

00:11:21.440 --> 00:11:25.040
unless it got blocked
by bedrock or something,

00:11:25.040 --> 00:11:26.640
or there's like a cave down there

00:11:26.640 --> 00:11:29.440
where it couldn't spawn in,
there will be a diamond ore

00:11:29.440 --> 00:11:30.280
under this block.

00:11:30.280 --> 00:11:34.080
- Let's give it a shot.
- All right.

00:11:34.080 --> 00:11:39.760
- Oh, no way.
- Did you get anything?

00:11:39.760 --> 00:11:43.320
- I did. I got eight.
- You got eight. Let's go.

00:11:43.320 --> 00:11:45.520
- I got eight.
Oh, I'm a rich man.

00:11:45.520 --> 00:11:46.480
Thank you, Matthew.

00:11:46.480 --> 00:11:47.240
- Okay.

00:11:47.240 --> 00:11:49.760
- In this version of
Minecraft we're playing,

00:11:49.760 --> 00:11:51.520
the game uses an algorithm

00:11:51.520 --> 00:11:54.560
to generate the pseudo
random numbers that determine

00:11:54.560 --> 00:11:58.160
where resources like
clay and diamonds appear.

00:11:58.160 --> 00:12:00.080
It works something like this.

00:12:00.080 --> 00:12:02.800
So I'm going to take a
wheel with seven positions.

00:12:02.800 --> 00:12:06.000
It has numbers going
from zero through to six.

00:12:06.000 --> 00:12:08.240
And what we're going to
do is we'll start at one

00:12:08.240 --> 00:12:10.560
and then multiply by some number.

00:12:10.560 --> 00:12:12.240
In this case, say three.

00:12:12.240 --> 00:12:14.000
So one times three gives us three,

00:12:14.000 --> 00:12:16.880
so we move the arrow to three.

00:12:16.880 --> 00:12:20.400
Now, we multiply three by
three again and we get nine,

00:12:20.400 --> 00:12:23.200
but there are only seven
positions on this wheel,

00:12:23.200 --> 00:12:24.880
so we're going to have to wrap around.

00:12:24.880 --> 00:12:27.440
Essentially, what we're doing
is dividing nine by seven,

00:12:27.440 --> 00:12:29.200
and that gives us a remainder of two.

00:12:29.200 --> 00:12:32.720
So we're going to wrap
around and go to two.

00:12:32.720 --> 00:12:34.640
This kind of wrapping

00:12:34.640 --> 00:12:37.920
around pattern is called
modular arithmetic or just mod.

00:12:37.920 --> 00:12:41.440
And now we keep going. So
two times three is six,

00:12:41.440 --> 00:12:43.120
so we move to six.

00:12:43.120 --> 00:12:45.120
And then six times three is 18.

00:12:45.120 --> 00:12:47.440
If you divide 18 by seven, you get two

00:12:47.440 --> 00:12:48.720
with the remainder of four.

00:12:48.720 --> 00:12:51.600
So we get to four. Four times three is 12.

00:12:51.600 --> 00:12:54.000
The remainder after
dividing by seven is five.

00:12:54.000 --> 00:12:55.680
Five times three is 15.

00:12:55.680 --> 00:12:58.400
And the remainder after
dividing by seven is one.

00:12:58.400 --> 00:13:00.880
So what we've done is we've
gone through every number except

00:13:00.880 --> 00:13:03.600
for zero before we started to repeat.

00:13:03.600 --> 00:13:06.800
The formula for this kind of
algorithm looks like this.

00:13:06.800 --> 00:13:08.640
There's a simple linear relationship

00:13:08.640 --> 00:13:11.520
between the current number and the next,

00:13:11.520 --> 00:13:14.320
but the mod step keeps only the remainder

00:13:14.320 --> 00:13:15.760
after dividing by m.

00:13:15.760 --> 00:13:18.480
So instead of continuing
up one straight line,

00:13:18.480 --> 00:13:20.880
the values wrap around falling along

00:13:20.880 --> 00:13:23.040
these parallel diagonals.

00:13:23.040 --> 00:13:26.640
So it is a linear rule
using modular arithmetic,

00:13:26.640 --> 00:13:28.400
also called congruences.

00:13:28.400 --> 00:13:29.520
So these kinds

00:13:29.520 --> 00:13:32.880
of pseudorandom number
generators got the name linear

00:13:32.880 --> 00:13:38.160
congruential generators,
better known as LCGs.

00:13:38.160 --> 00:13:39.680
With much larger numbers,

00:13:39.680 --> 00:13:42.480
LCGs can produce enormously long sequences

00:13:42.480 --> 00:13:43.920
of numbers before they repeat.

00:13:43.920 --> 00:13:47.600
In the 1960s, IBM
developed one called RANDU.

00:13:47.600 --> 00:13:50.240
It was included in IBM's
scientific software

00:13:50.240 --> 00:13:53.520
and used in simulations of
everything from radioactive decay

00:13:53.520 --> 00:13:57.120
to instruments aboard
NASA's Skylab Space Station.

00:13:57.120 --> 00:14:00.000
And RANDU could generate
over half a billion numbers

00:14:00.000 --> 00:14:01.760
before repeating, so at least

00:14:01.760 --> 00:14:03.600
that was one problem dealt with.

00:14:03.600 --> 00:14:06.960
But a long sequence doesn't
necessarily mean a good one.

00:14:06.960 --> 00:14:09.680
Take a look at what happens
if we take every three

00:14:09.680 --> 00:14:11.360
consecutive numbers and we plot them

00:14:11.360 --> 00:14:14.800
as coordinates in
three-dimensional space, right?

00:14:14.800 --> 00:14:17.520
If the numbers behaved
independently, we'd expect the points

00:14:17.520 --> 00:14:20.400
to fill the cube kind of in a fuzzy cloud.

00:14:20.400 --> 00:14:22.960
And from this angle,
they certainly seem to,

00:14:22.960 --> 00:14:24.240
and for most angles they do,

00:14:24.240 --> 00:14:27.840
but if you rotate the cube
in just the right way,

00:14:27.840 --> 00:14:31.680
you can see that they
actually line up in these 15

00:14:31.680 --> 00:14:33.440
rows throughout the cube.

00:14:33.440 --> 00:14:34.560
There are enormous gaps

00:14:34.560 --> 00:14:36.320
where RANDU will never place a point,

00:14:36.320 --> 00:14:38.800
and it turns out that that is
just an unavoidable feature

00:14:38.800 --> 00:14:42.720
of all LCGs because of
that linear relationship.

00:14:42.720 --> 00:14:44.960
The second number is
calculated from the first

00:14:44.960 --> 00:14:48.720
and the third from the second
using exactly the same rule.

00:14:48.720 --> 00:14:52.240
So all three numbers are
linked by a linear equation.

00:14:52.240 --> 00:14:53.600
And in three dimensions,

00:14:53.600 --> 00:14:56.000
a linear equation describes a plane,

00:14:56.000 --> 00:15:00.480
and the mod step creates a
series of parallel planes.

00:15:00.480 --> 00:15:02.640
RANDU's particular choice of numbers made

00:15:02.640 --> 00:15:04.640
that pattern especially obvious,

00:15:04.640 --> 00:15:07.040
but other LCGs are much better at this.

00:15:07.040 --> 00:15:09.280
In the 1990s, Java adopted one

00:15:09.280 --> 00:15:11.920
that adds a constant
using a better multiplier

00:15:11.920 --> 00:15:13.760
and a much larger modulus.

00:15:13.760 --> 00:15:18.960
Its sequence takes over 281
trillion steps before repeating.

00:15:18.960 --> 00:15:21.360
We can also plot its outputs the same way,

00:15:21.360 --> 00:15:23.520
and what we get is this.

00:15:23.520 --> 00:15:25.200
Now the planes are actually still there,

00:15:25.200 --> 00:15:26.320
but we can't see them

00:15:26.320 --> 00:15:28.720
because they're so closely packed together

00:15:28.720 --> 00:15:32.160
that the points more or less
look like a random cloud.

00:15:32.160 --> 00:15:36.960
So that is problem two dealt with.

00:15:36.960 --> 00:15:41.120
- Occupational hazard.

00:15:41.120 --> 00:15:43.680
- This edition of
Minecraft is coded in Java.

00:15:43.680 --> 00:15:46.880
So for most of the game's
history, it used Java's LCG

00:15:46.880 --> 00:15:50.560
to determine the placement of
resources in a given chunk.

00:15:50.560 --> 00:15:53.280
But when Minecraft generated
different resources,

00:15:53.280 --> 00:15:56.080
it didn't use completely
independent starting numbers.

00:15:56.080 --> 00:15:58.640
Instead, it took the same underlying seed

00:15:58.640 --> 00:16:01.520
and added a different fixed
number for each resource.

00:16:01.520 --> 00:16:03.280
So for diamonds and river clay,

00:16:03.280 --> 00:16:06.320
those starting numbers
differed by just three.

00:16:06.320 --> 00:16:08.160
Java then modified those seeds

00:16:08.160 --> 00:16:10.800
before using them, so the
difference wasn't always three

00:16:10.800 --> 00:16:13.440
anymore, but in most
worlds, it fell into one

00:16:13.440 --> 00:16:15.680
of a few predictable values.

00:16:15.680 --> 00:16:18.560
And because they went through
the same LCG, the numbers used

00:16:18.560 --> 00:16:21.120
to choose their position were related.

00:16:21.120 --> 00:16:22.400
If you compare the results,

00:16:22.400 --> 00:16:25.520
the shared unknown part cancels out.

00:16:25.520 --> 00:16:26.800
So I didn't need

00:16:26.800 --> 00:16:28.880
to know the original seed
of the Minecraft world.

00:16:28.880 --> 00:16:30.560
The location of the clay patch was enough

00:16:30.560 --> 00:16:32.320
to tell me where to look.

00:16:32.320 --> 00:16:35.040
Matthew has a great video on
his channel that works through

00:16:35.040 --> 00:16:36.640
how this works in more detail.

00:16:36.640 --> 00:16:37.600
We've linked it in the

00:16:37.600 --> 00:16:41.600
description if you want
to go check it out.

00:16:41.600 --> 00:16:43.760
But there is a more fundamental problem.

00:16:43.760 --> 00:16:46.720
The outputs themselves can
reveal enough information

00:16:46.720 --> 00:16:49.280
to predict what comes next.

00:16:49.280 --> 00:16:52.400
See, Java's LCG keeps
track of an internal number

00:16:52.400 --> 00:16:55.440
that is made up of 48 binary digits,

00:16:55.440 --> 00:16:57.680
and this is what Java's LCG uses

00:16:57.680 --> 00:17:00.400
to generate the next
number in the sequence.

00:17:00.400 --> 00:17:03.040
But when it generates an integer output,

00:17:03.040 --> 00:17:04.640
it actually reveals 32

00:17:04.640 --> 00:17:07.840
of those digits leaving just 16 hidden.

00:17:07.840 --> 00:17:11.920
And since it's binary, each
can only be a zero or a one.

00:17:11.920 --> 00:17:16.960
So that's just 65,536 possible values.

00:17:16.960 --> 00:17:18.480
Now, maybe that sounds like a lot,

00:17:18.480 --> 00:17:21.520
but a computer can test them
against the very next output

00:17:21.520 --> 00:17:24.320
of the generator and only one matches.

00:17:24.320 --> 00:17:27.040
And then you know the full
48 bit internal number,

00:17:27.040 --> 00:17:29.120
and once you know that, you can calculate

00:17:29.120 --> 00:17:31.280
every number that follows.

00:17:31.280 --> 00:17:33.760
And this is actually
the same for all LCGs.

00:17:33.760 --> 00:17:36.000
They can produce incredibly long sequences

00:17:36.000 --> 00:17:37.840
with no obvious patterns,

00:17:37.840 --> 00:17:40.640
but their simple
mathematical structure still

00:17:40.640 --> 00:17:42.160
makes them predictable.

00:17:42.160 --> 00:17:46.240
- Like LCGs, they're, they're not good.

00:17:46.240 --> 00:17:49.360
They, they, they cause
all sorts of problems.

00:17:49.360 --> 00:17:51.040
They're very exploitable.
They're for when you're,

00:17:51.040 --> 00:17:53.280
you have like a video game and
you just need something quick

00:17:53.280 --> 00:17:56.080
and dirty and you're not too
worried about people like me.

00:17:56.080 --> 00:17:58.240
- But I should point out that
this trick doesn't actually

00:17:58.240 --> 00:18:00.680
work on the most recent
versions of Minecraft.

00:18:00.680 --> 00:18:04.160
- Once I published this
trick, it got patched out

00:18:04.160 --> 00:18:05.760
of the game very quickly.

00:18:05.760 --> 00:18:10.080
- Oh, no way.
- I think a bug report was made

00:18:10.080 --> 00:18:12.080
in the version 1.18.

00:18:12.080 --> 00:18:15.360
What they did is they actually
switched the random number

00:18:15.360 --> 00:18:18.560
generator that Minecraft
uses to generate ores

00:18:18.560 --> 00:18:20.320
to a different random number generator

00:18:20.320 --> 00:18:21.840
that would not have the particular

00:18:21.840 --> 00:18:23.280
flaw we're exploiting here.

00:18:23.280 --> 00:18:24.800
- They changed the whole,

00:18:24.800 --> 00:18:26.160
changed the whole number generator.

00:18:26.160 --> 00:18:29.520
- Yeah, exactly. You can do the honours.

00:18:29.520 --> 00:18:33.520
- Okay, okay, okay. Let's
see if I can remember.

00:18:33.520 --> 00:18:38.240
- Oh
- Boy. Okay, check this out. Here you go.

00:18:38.240 --> 00:18:44.960
Pants, boots, chest piece, helmet.

00:18:44.960 --> 00:18:46.240
The trick in Minecraft works

00:18:46.240 --> 00:18:47.600
because the developers chose

00:18:47.600 --> 00:18:50.080
to put this particular random
number generator into the

00:18:50.080 --> 00:18:51.360
game, but it's a good reminder of

00:18:51.360 --> 00:18:53.600
how much the tools you use matter

00:18:53.600 --> 00:18:55.040
when you're building software.

00:18:55.040 --> 00:18:57.520
And that brings me to
today's sponsor, Hostinger.

00:18:57.520 --> 00:19:01.120
Hostinger is an all-in-one
platform for building, running,

00:19:01.120 --> 00:19:02.560
and growing businesses online.

00:19:02.560 --> 00:19:04.960
So whether you need a website or a web app

00:19:04.960 --> 00:19:07.760
or an online store, you can
manage it all from one place,

00:19:07.760 --> 00:19:10.320
and you don't even have
to know how to code.

00:19:10.320 --> 00:19:11.920
So for example, let's say I want

00:19:11.920 --> 00:19:14.320
to start a business selling
all those hard earned

00:19:14.320 --> 00:19:15.760
diamonds that I just mined.

00:19:15.760 --> 00:19:18.880
So I can just describe the
website I want in plain English

00:19:18.880 --> 00:19:22.720
and Hostinger's AI is going
to build an initial version.

00:19:22.720 --> 00:19:26.240
And if I want to change
something, I can just describe it,

00:19:26.240 --> 00:19:27.680
but that is just a starting point

00:19:27.680 --> 00:19:30.560
because I can also add my own custom code.

00:19:30.560 --> 00:19:32.800
Instead of having to build
everything from scratch,

00:19:32.800 --> 00:19:35.920
I can just spend more
time mining diamonds.

00:19:35.920 --> 00:19:38.960
Right now, Hostinger is
doing Black Friday offers,

00:19:38.960 --> 00:19:41.840
and if you go to hostinger.com/veritasium,

00:19:41.840 --> 00:19:44.800
you can use code Veritasium
for an additional 10% off.

00:19:44.800 --> 00:19:46.640
I want to thank Hostinger
for sponsoring this part

00:19:46.640 --> 00:19:48.720
of the video, and now back to the casino

00:19:48.720 --> 00:19:51.280
where gamblers were exploiting
random number generators

00:19:51.280 --> 00:19:58.240
to win thousands of dollars.

00:19:58.240 --> 00:20:01.760
On July 14th, 2014,
investigators detained one

00:20:01.760 --> 00:20:04.880
of the gamblers who had been
repeatedly winning on slot

00:20:04.880 --> 00:20:06.560
machines across the US.

00:20:06.560 --> 00:20:09.360
- So when they picked these
guys up in California,

00:20:09.360 --> 00:20:11.440
they were able to get one of the phones

00:20:11.440 --> 00:20:15.200
and they were able to see that
the video was actually being

00:20:15.200 --> 00:20:17.480
transmitted back to a server in Russia.

00:20:17.480 --> 00:20:19.520
- More specifically, a team in St.

00:20:19.520 --> 00:20:23.920
Petersburg, led by a
hacker only known as Alex.

00:20:23.920 --> 00:20:26.320
Five years earlier, Russia
actually banned most

00:20:26.320 --> 00:20:27.840
of its gambling and thousands

00:20:27.840 --> 00:20:29.920
of slot machines were being sold off.

00:20:29.920 --> 00:20:32.560
So Alex got hold of some of these machines

00:20:32.560 --> 00:20:34.160
and started taking them apart.

00:20:34.160 --> 00:20:36.400
- There's a processing board,

00:20:36.400 --> 00:20:38.480
and then there's what
they refer to as a SMIB,

00:20:38.480 --> 00:20:40.880
which is a slot machine interface board.

00:20:40.880 --> 00:20:42.080
Basically, the, the,

00:20:42.080 --> 00:20:44.960
the processing board is
locked into the game.

00:20:44.960 --> 00:20:48.400
That comes with the
machine. So if you can...

00:20:48.400 --> 00:20:50.400
Once you have access to the device, it's,

00:20:50.400 --> 00:20:52.160
it's just a matter of
time before you're...

00:20:52.160 --> 00:20:53.480
It's reverse engineered.

00:20:53.480 --> 00:20:55.760
- The thing is though,
these machines weren't

00:20:55.760 --> 00:20:57.440
using an LCG like Java.

00:20:57.440 --> 00:21:00.400
They used a far more complicated
random number generator.

00:21:00.400 --> 00:21:02.240
- A lot of them were using the same

00:21:02.960 --> 00:21:04.840
Mersenne Twister algorithm.

00:21:04.840 --> 00:21:07.840
- This algorithm still starts with a seed,

00:21:07.840 --> 00:21:10.560
but instead of using this
to generate one number,

00:21:10.560 --> 00:21:14.800
it fills a table of 624 numbers.

00:21:14.800 --> 00:21:17.520
It then performs a
calculation called a twist,

00:21:17.520 --> 00:21:19.680
combining the binary
digits from different parts

00:21:19.680 --> 00:21:24.160
of the table to produce 624 new numbers.

00:21:24.160 --> 00:21:26.880
Then it takes the first number
in this new table, runs it

00:21:26.880 --> 00:21:28.800
through another series of calculations,

00:21:28.800 --> 00:21:32.800
and it produces its first
pseudo-random output.

00:21:32.800 --> 00:21:34.640
It does the same with the next number

00:21:34.640 --> 00:21:39.680
and the next until it
has produced 624 outputs.

00:21:39.680 --> 00:21:41.680
Then it twists the whole table again

00:21:41.680 --> 00:21:44.800
and the process continues,
and its sequence is huge.

00:21:44.800 --> 00:21:47.680
The number of steps before
it repeats has more than

00:21:47.680 --> 00:21:49.840
6,000 digits.

00:21:50.640 --> 00:21:54.320
But despite all that, every
step still followed these fixed

00:21:54.320 --> 00:21:56.400
mathematical rules, and those were rules

00:21:56.400 --> 00:21:58.000
that Alex was actually able to work out

00:21:58.000 --> 00:22:01.040
by studying the software
inside of his own machines.

00:22:01.040 --> 00:22:03.360
So when his team received videos

00:22:03.360 --> 00:22:07.120
of spins from casinos in the
US, they could work backwards

00:22:07.120 --> 00:22:09.520
and they could compare them
with their own machines

00:22:09.520 --> 00:22:13.360
and predict when a winning
spin was most likely.

00:22:13.360 --> 00:22:14.880
But inside the slot machines,

00:22:14.880 --> 00:22:17.520
the random number generator
kept running even when nobody

00:22:17.520 --> 00:22:20.640
was playing, and the outcome
depended on the number selected

00:22:20.640 --> 00:22:23.600
at the instant the player pressed spin.

00:22:23.600 --> 00:22:27.120
So the gamblers had to press
at exactly the right time,

00:22:27.120 --> 00:22:30.400
but it takes a human roughly a
quarter of a second to react.

00:22:30.400 --> 00:22:33.200
So Alex built that delay into the system.

00:22:33.200 --> 00:22:36.320
He created an app that made
the gambler's phone vibrate a

00:22:36.320 --> 00:22:38.560
quarter of a second before
they actually needed

00:22:38.560 --> 00:22:43.360
to press, and...

00:22:43.360 --> 00:22:46.720
Now, this trick didn't
guarantee a win on every spin,

00:22:46.720 --> 00:22:49.760
but a four-person team could
reportedly take more than

00:22:49.760 --> 00:22:54.640
$250,000 in a week, so
it was pretty effective.

00:22:54.640 --> 00:22:56.960
In the end, the four men
who were caught as part

00:22:56.960 --> 00:23:00.320
of the scheme were charged with
conspiracy to commit fraud.

00:23:00.320 --> 00:23:02.800
Three of them were sentenced
to two years in prison,

00:23:02.800 --> 00:23:06.000
while one chose to cooperate with the FBI.

00:23:06.000 --> 00:23:08.320
Oh, but is it possible that
people are still running this

00:23:08.320 --> 00:23:10.640
exploit in casinos still?

00:23:10.640 --> 00:23:15.040
- Yeah, I would be completely
surprised if they weren't.

00:23:15.040 --> 00:23:16.960
- Oh, really?
- Yeah. Yeah.

00:23:16.960 --> 00:23:19.200
There's a lot of those
boxes are still out there.

00:23:19.200 --> 00:23:20.720
- So ultimately, all

00:23:20.720 --> 00:23:23.760
of these generators fail at
being unpredictable if you know

00:23:23.760 --> 00:23:25.040
enough about how they work

00:23:25.040 --> 00:23:27.760
and if you can study
enough of their outputs.

00:23:27.760 --> 00:23:30.800
But we need random numbers
for digital security.

00:23:30.800 --> 00:23:32.960
They're used to protect
everything from our messages

00:23:32.960 --> 00:23:36.080
to our bank accounts, and if
those numbers can be predicted,

00:23:36.080 --> 00:23:40.000
then that security can be compromised.

00:23:40.000 --> 00:23:42.400
So we went to the National
Institute of Standards

00:23:42.400 --> 00:23:44.560
and Technology in Boulder, Colorado.

00:23:44.560 --> 00:23:48.320
NIST sets the standards for
secure random number generation,

00:23:48.320 --> 00:23:51.480
but one team there is trying
something even more ambitious.

00:23:51.480 --> 00:23:54.480
- So what we're trying to do is say,

00:23:54.480 --> 00:23:56.640
what's the best random number generator

00:23:56.640 --> 00:23:59.520
that nature allows you to build?

00:23:59.520 --> 00:24:01.200
- Yeah.
- And that's a lot of

00:24:01.200 --> 00:24:02.160
what our work is here.

00:24:02.160 --> 00:24:03.840
- And that's what, that's
what this is about.

00:24:03.840 --> 00:24:06.720
- Yep. This is what all of
this experiment is to try

00:24:06.720 --> 00:24:09.680
to make the world's best random
number generator, really try

00:24:09.680 --> 00:24:11.200
to use physics

00:24:11.200 --> 00:24:14.640
and science to try to develop the best

00:24:14.640 --> 00:24:16.320
measurements possible.

00:24:16.320 --> 00:24:19.680
And then we use those
measurements to develop standards.

00:24:19.680 --> 00:24:22.560
- And that includes the standards

00:24:22.560 --> 00:24:25.200
for generating random
numbers for digital security,

00:24:25.200 --> 00:24:27.440
because for encryption,
you need generators

00:24:27.440 --> 00:24:28.960
that are much harder to predict than

00:24:28.960 --> 00:24:30.320
the ones we've seen so far.

00:24:30.320 --> 00:24:32.560
So cryptographers have developed a

00:24:32.560 --> 00:24:34.160
different kind of generator.

00:24:34.160 --> 00:24:36.480
The idea behind them is pretty simple.

00:24:36.480 --> 00:24:39.680
Start with a string of numbers,
say just one, two, three,

00:24:39.680 --> 00:24:42.400
four, and so on, and now you feed each

00:24:42.400 --> 00:24:44.560
of those numbers into
an encryption algorithm.

00:24:44.560 --> 00:24:47.440
The algorithm scrambles
them using a secret key,

00:24:47.440 --> 00:24:50.320
which is based on a large random number.

00:24:50.320 --> 00:24:53.280
Encryption transforms
the inputs so thoroughly

00:24:53.280 --> 00:24:57.120
that without the key, the outputs
look completely unrelated.

00:24:57.120 --> 00:25:00.640
In a way, that key plays
the role of a seed.

00:25:00.640 --> 00:25:02.720
It's the one random
number you need to start,

00:25:02.720 --> 00:25:06.000
and it decides every
number that comes out.

00:25:06.000 --> 00:25:08.800
Where with Java, its outputs revealed most

00:25:08.800 --> 00:25:11.600
of its hidden state, and
with the Mersenne Twister ,

00:25:11.600 --> 00:25:14.960
even the extra steps hiding
its outputs could be reversed.

00:25:14.960 --> 00:25:18.240
Here, even if you know exactly
how the encryption works,

00:25:18.240 --> 00:25:19.760
and you've seen all its inputs

00:25:19.760 --> 00:25:22.160
and outputs, there's no practical way

00:25:22.160 --> 00:25:24.880
to recover the secret key.

00:25:24.880 --> 00:25:27.280
And guessing it isn't realistic either.

00:25:27.280 --> 00:25:32.320
A common key length is
128 bits, so that's 128

00:25:32.320 --> 00:25:35.760
ones and zeros and over
300 trillion, trillion,

00:25:35.760 --> 00:25:38.720
trillion possible keys.

00:25:38.720 --> 00:25:40.480
And without the key, predicting the next

00:25:40.480 --> 00:25:42.640
output, it's practically impossible.

00:25:42.640 --> 00:25:44.400
This is one of the ways
that you can build a

00:25:44.400 --> 00:25:47.040
cryptographically secure
pseudo-random number generator,

00:25:47.040 --> 00:25:50.240
and it solves our third
problem, predictability.

00:25:50.240 --> 00:25:53.200
But where did that secret
key actually come from?

00:25:53.200 --> 00:25:56.480
Because the algorithm can't
create unpredictability from

00:25:56.480 --> 00:25:58.320
nothing on its own, it actually needs

00:25:58.320 --> 00:25:59.920
something random to start with.

00:25:59.920 --> 00:26:02.720
And for that, computers
turn to the physical world.

00:26:02.720 --> 00:26:05.600
Many modern processors
have built in hardware,

00:26:05.600 --> 00:26:06.720
random number generators

00:26:06.720 --> 00:26:09.920
that measure tiny fluctuations
in electrical signals

00:26:09.920 --> 00:26:13.120
to provide those unpredictable seeds.

00:26:13.120 --> 00:26:15.280
One company in California, Cloudflare,

00:26:15.280 --> 00:26:17.920
even uses a whole wall of lava lamps

00:26:17.920 --> 00:26:20.640
to generate random seeds
for its algorithms.

00:26:21.440 --> 00:26:25.280
So does that mean the problem
is solved? Not exactly.

00:26:25.280 --> 00:26:28.400
If you take a coin toss,
we normally think of this

00:26:28.400 --> 00:26:31.920
as a random event, heads or tails.

00:26:31.920 --> 00:26:34.560
Only under carefully
controlled conditions,

00:26:34.560 --> 00:26:37.840
you can actually make the coin
land heads every single time,

00:26:37.840 --> 00:26:40.480
and that's because a coin follows the laws

00:26:40.480 --> 00:26:42.080
of classical mechanics.

00:26:42.080 --> 00:26:44.800
So if you control exactly how it starts

00:26:44.800 --> 00:26:47.360
and how it's flipped, you can predict

00:26:47.360 --> 00:26:49.760
how it will land every single time.

00:26:49.760 --> 00:26:51.920
The French mathematician,
Pierre-Simon Laplace,

00:26:51.920 --> 00:26:53.920
actually took this idea even further.

00:26:53.920 --> 00:26:56.720
He imagined an intelligence
that knew the position

00:26:56.720 --> 00:26:59.760
and motion of every
particle in the universe.

00:26:59.760 --> 00:27:01.840
So according to classical mechanics,

00:27:01.840 --> 00:27:04.560
it could calculate everything
that would ever happen.

00:27:04.560 --> 00:27:07.120
- You know, I looked long
and hard to try to figure out

00:27:07.120 --> 00:27:09.430
what is a good definition of randomness.

00:27:09.430 --> 00:27:10.080
- Yeah.
- And my&nbsp;&nbsp;

00:27:10.080 --> 00:27:12.720
definition of randomness is just something

00:27:12.720 --> 00:27:16.320
that nobody could have
predicted in advance.

00:27:16.320 --> 00:27:18.160
And not just nobody, I
don't mean just humans,

00:27:18.160 --> 00:27:20.000
but like anything in the universe.

00:27:20.000 --> 00:27:23.760
- So that's what Krister's
team is trying to achieve,

00:27:23.760 --> 00:27:26.000
not just to generate
numbers that seem random,

00:27:26.000 --> 00:27:28.920
but to prove that they are
genuinely unpredictable.

00:27:28.920 --> 00:27:31.200
- We don't want to do seeds at all,

00:27:31.200 --> 00:27:32.960
and we don't want to do algorithms at all.

00:27:32.960 --> 00:27:34.880
- So they've turned to quantum mechanics

00:27:34.880 --> 00:27:37.520
because some quantum
measurement outcomes are

00:27:37.520 --> 00:27:39.280
fundamentally unpredictable.

00:27:39.280 --> 00:27:44.240
- So on this setup right here
we start with a very bright

00:27:44.240 --> 00:27:46.160
laser, very intense laser.

00:27:46.160 --> 00:27:47.840
We're generating about a hundred million

00:27:47.840 --> 00:27:49.520
of these pulses per second,

00:27:49.520 --> 00:27:52.560
and this pulse of, of light comes in

00:27:52.560 --> 00:27:54.960
and interacts with this crystal here.

00:27:54.960 --> 00:27:57.680
What can happen is the
interaction of this light

00:27:57.680 --> 00:28:01.920
with this crystal sometimes one of our

00:28:01.920 --> 00:28:04.400
photons will interact with it

00:28:04.400 --> 00:28:08.320
and fission into what we call
a pair of daughter photons.

00:28:08.320 --> 00:28:12.480
- Now, each photon has a
property called polarization,

00:28:12.480 --> 00:28:15.040
which corresponds to the
direction in which light's

00:28:15.040 --> 00:28:17.200
electric field oscillates.

00:28:17.200 --> 00:28:19.680
And the researchers have
arranged the experiment so

00:28:19.680 --> 00:28:21.200
that the pair can be produced

00:28:21.200 --> 00:28:24.320
with both photons polarized
either horizontally

00:28:24.320 --> 00:28:28.320
or both vertically, but there's
no way to distinguish which.

00:28:28.320 --> 00:28:31.120
So the photons end up in
a quantum superposition

00:28:31.120 --> 00:28:32.880
of both possibilities.

00:28:32.880 --> 00:28:36.160
- This is very much like a
Schrödinger cat type state,

00:28:36.160 --> 00:28:38.240
but extended to two particles,

00:28:38.240 --> 00:28:40.240
and now it's like they're kind of both

00:28:40.240 --> 00:28:41.720
of those at the same time.

00:28:41.720 --> 00:28:44.720
- The photons share a
quantum state no matter

00:28:44.720 --> 00:28:46.160
where in the universe they are.

00:28:46.160 --> 00:28:48.720
In other words, they are entangled.

00:28:48.720 --> 00:28:50.880
And this means that when we measure both,

00:28:50.880 --> 00:28:53.680
the results are correlated.

00:28:53.680 --> 00:28:55.680
But first, they need to send the photons

00:28:55.680 --> 00:28:58.160
to two separate measurement stations,

00:28:58.160 --> 00:28:59.360
and that means they have

00:28:59.360 --> 00:29:02.280
to get each photon into an optical fiber.

00:29:02.280 --> 00:29:07.360
- The really hard part is
these fiber cables right here,

00:29:07.360 --> 00:29:10.240
the actual fiber optic cable
inside, you can't see it.

00:29:10.240 --> 00:29:12.640
It's only about 10 microns in diameter.

00:29:12.640 --> 00:29:15.760
- Yeah.
- And to put that in context,

00:29:15.760 --> 00:29:18.400
that's about one-tenth the diameter

00:29:18.400 --> 00:29:20.560
or width of a human hair.

00:29:20.560 --> 00:29:22.880
So it's a very, very tiny target.

00:29:22.880 --> 00:29:25.440
And what we have to do is what I like

00:29:25.440 --> 00:29:27.280
to call quantum archery.

00:29:27.280 --> 00:29:29.760
So, you know, I think about Robin Hood

00:29:29.760 --> 00:29:32.560
and the fact that, you know,
you could kind of pull back

00:29:32.560 --> 00:29:33.920
and shoot an arrow

00:29:33.920 --> 00:29:35.720
and hit a target and dead in the bullseye.

00:29:35.720 --> 00:29:37.360
Yeah. And then it can keep shooting arrows

00:29:37.360 --> 00:29:40.880
and keep splitting the
center of the arrow.

00:29:40.880 --> 00:29:42.960
We're doing a version of that

00:29:42.960 --> 00:29:46.800
where now Robin Hood has two
targets and he has a single bow

00:29:46.800 --> 00:29:49.200
and he has to shoot two arrows at a time,

00:29:49.200 --> 00:29:51.440
and yet he's able to continually keep

00:29:51.440 --> 00:29:52.920
splitting these two targets.

00:29:52.920 --> 00:29:56.440
- Into these 10 micron holes.
- Into these 10 micron holes.

00:29:56.440 --> 00:30:00.320
- The photons then arrive
at two measurement stations

00:30:00.320 --> 00:30:02.800
110 meters apart.

00:30:02.800 --> 00:30:05.280
This means that even a
signal traveling at the speed

00:30:05.280 --> 00:30:07.680
of light can't get from
one to the other in time

00:30:07.680 --> 00:30:09.680
to impact the measurement.

00:30:09.680 --> 00:30:11.200
Now, at each station,

00:30:11.200 --> 00:30:13.680
the researchers measure
the photon's polarization,

00:30:13.680 --> 00:30:15.520
but they can choose between two different

00:30:15.520 --> 00:30:17.200
angles to measure it at.

00:30:17.200 --> 00:30:20.000
And each station chooses
its angle at random just

00:30:20.000 --> 00:30:22.240
before the photon arrives.

00:30:22.240 --> 00:30:25.840
What sort of result are you getting here

00:30:25.840 --> 00:30:29.960
and there that gives you that
ultimate final random number?

00:30:29.960 --> 00:30:32.960
- I either detect a photon or I don't.
- Okay.

00:30:32.960 --> 00:30:37.760
A detection gives us a one.
No detection gives us a zero.

00:30:37.760 --> 00:30:40.400
But wait, they're using random numbers

00:30:40.400 --> 00:30:43.200
to choose the measurements in
an experiment that is designed

00:30:43.200 --> 00:30:44.960
to generate random numbers.

00:30:44.960 --> 00:30:47.840
It doesn't make sense.
How are these guys random

00:30:47.840 --> 00:30:49.520
if they don't use the whole setup?

00:30:49.520 --> 00:30:53.040
- So you know, it takes
randomness to, to make randomness.

00:30:53.040 --> 00:30:54.960
You just need pretty good randomness.

00:30:54.960 --> 00:30:58.080
And this whole setup is
a way to kind of purify

00:30:58.080 --> 00:31:00.720
or take, you know, what
is pretty good randomness

00:31:00.720 --> 00:31:03.360
and turn it into something
that is like certifiably

00:31:03.360 --> 00:31:04.720
like really good randomness.

00:31:04.720 --> 00:31:07.760
- The first numbers choose
which measurements to perform,

00:31:07.760 --> 00:31:10.720
but the numbers NIST wants
to certify are the zeroes

00:31:10.720 --> 00:31:13.600
and ones coming out of the detectors.

00:31:13.600 --> 00:31:16.720
Because each station has two
possible measurement angles,

00:31:16.720 --> 00:31:19.760
there are four possible
combinations of measurements.

00:31:19.760 --> 00:31:22.160
Now, if the photons were
simply carrying predetermined

00:31:22.160 --> 00:31:24.560
answers for every possible measurement,

00:31:24.560 --> 00:31:26.240
there's a mathematical limit to

00:31:26.240 --> 00:31:27.920
how strongly the results from the two

00:31:27.920 --> 00:31:29.840
stations could be correlated.

00:31:29.840 --> 00:31:32.240
But when the researchers
compare the results,

00:31:32.240 --> 00:31:35.120
the correlations exceed that limit.

00:31:35.120 --> 00:31:38.480
This is called a violation
of Bell's inequality.

00:31:38.480 --> 00:31:41.200
We actually made an entire
video about Bell tests

00:31:41.200 --> 00:31:43.440
and it goes much deeper into the topic.

00:31:43.440 --> 00:31:45.200
So we've linked it in the
description if you want

00:31:45.200 --> 00:31:47.200
to find out more about how this works.

00:31:47.200 --> 00:31:49.440
Because the measurement
choices are independent

00:31:49.440 --> 00:31:51.520
and that the stations can't communicate

00:31:51.520 --> 00:31:54.800
during the measurements, that
means the photons' results

00:31:54.800 --> 00:31:56.640
can't be explained by any kind

00:31:56.640 --> 00:31:58.960
of locally predetermined outcome.

00:31:58.960 --> 00:32:02.480
So the experiment is actually
testing whether those numbers

00:32:02.480 --> 00:32:05.120
contain genuine unpredictability.

00:32:05.120 --> 00:32:07.120
But there are other potential loopholes.

00:32:07.120 --> 00:32:08.960
- The one that my own group got involved

00:32:08.960 --> 00:32:11.360
with was called the
Freedom of Choice loophole.

00:32:11.360 --> 00:32:14.320
No one should be
surprised if a student

00:32:14.320 --> 00:32:16.480
gets the quiz ahead of time, knows

00:32:16.480 --> 00:32:17.520
what questions she'll be asked,

00:32:17.520 --> 00:32:19.280
and then aces the quiz the next day.

00:32:19.280 --> 00:32:21.680
These particles, again, to
speak kind of anthropomorphically,

00:32:21.680 --> 00:32:24.640
shouldn't be allowed to know
what questions they'll be posed

00:32:24.640 --> 00:32:26.960
before they reach their detectors.

00:32:26.960 --> 00:32:30.320
And that goes back to
randomness really at its core.

00:32:30.320 --> 00:32:32.560
Can you really be confident
that the selection

00:32:32.560 --> 00:32:35.120
of measurements to perform had no kind

00:32:35.120 --> 00:32:37.120
of correlations ahead of time?

00:32:37.120 --> 00:32:39.680
- There are a few ways to
do this, but David Kaiser

00:32:39.680 --> 00:32:41.520
and his collaborators came up with this.

00:32:41.520 --> 00:32:44.240
- What we wanted to do was
turn the universe itself into a

00:32:44.240 --> 00:32:45.760
pair of random number generators.

00:32:45.760 --> 00:32:50.160
- They pointed two telescopes
at distant quasars on opposite

00:32:50.160 --> 00:32:53.600
sides of the sky and used the
wavelengths from individual

00:32:53.600 --> 00:32:56.240
photons arriving from each of the quasars

00:32:56.240 --> 00:32:58.800
to choose which measurements to perform.

00:32:58.800 --> 00:33:02.160
Now, that light had been
traveling for billions of years,

00:33:02.160 --> 00:33:05.120
from regions of the universe
that hadn't been able

00:33:05.120 --> 00:33:08.400
to communicate with each other
since nearly the Big Bang.

00:33:08.400 --> 00:33:10.960
And assuming no one had
interfered with the light,

00:33:10.960 --> 00:33:13.600
any hidden coordination
between the measurement choices

00:33:13.600 --> 00:33:15.120
and the results would have had

00:33:15.120 --> 00:33:18.240
to happen billions of years ago.

00:33:18.240 --> 00:33:20.560
Now, this didn't completely
eliminate the loophole,

00:33:20.560 --> 00:33:24.240
but it pushed that possibility
much further back in time.

00:33:25.200 --> 00:33:27.600
David's team were investigating
whether some hidden

00:33:27.600 --> 00:33:29.600
explanation could account for the results,

00:33:29.600 --> 00:33:31.680
but NIST has to consider something else.

00:33:31.680 --> 00:33:34.080
- If I was a hacker, how would I attack

00:33:34.080 --> 00:33:35.600
the system? What would I do?

00:33:35.600 --> 00:33:38.560
In principle, two people
working together could shine

00:33:38.560 --> 00:33:40.040
their own light into those telescopes

00:33:40.040 --> 00:33:42.800
And control which measurements are selected

00:33:42.800 --> 00:33:45.200
and potentially rig the results.

00:33:45.200 --> 00:33:48.560
So NIST has to keep the
random number generators used

00:33:48.560 --> 00:33:51.280
to choose its measurements
basically protected from

00:33:51.280 --> 00:33:52.400
outside interference.

00:33:52.400 --> 00:33:54.960
They can't rely on quasar light for that.

00:33:54.960 --> 00:33:57.520
That makes it much harder for
someone to hack the system,

00:33:57.520 --> 00:34:00.480
but that doesn't prove their
choices are independent

00:34:00.480 --> 00:34:02.080
of the devices being tested.

00:34:02.080 --> 00:34:06.160
NIST still has to assume that
along with the impossibility

00:34:06.160 --> 00:34:09.120
of faster than light
signaling, accurate timing

00:34:09.120 --> 00:34:12.080
and distance measurements,
and faithful secure

00:34:12.080 --> 00:34:13.920
recording of the results.

00:34:13.920 --> 00:34:17.840
If those assumptions hold,
then the Bell test can certify

00:34:17.840 --> 00:34:19.440
how much genuine unpredictability

00:34:19.440 --> 00:34:21.720
the detector outputs contain.

00:34:21.720 --> 00:34:25.120
If we use entanglement,
you can do these types

00:34:25.120 --> 00:34:28.160
of measurements and you can
show that there's nothing

00:34:28.160 --> 00:34:30.720
that could have predicted
what's happening in advance.

00:34:30.720 --> 00:34:34.160
But the raw measurements
aren't necessarily an even

00:34:34.160 --> 00:34:36.080
mixture of ones and zeroes.

00:34:36.080 --> 00:34:38.400
There might be far more zeros than ones.

00:34:38.400 --> 00:34:40.400
The Bell test tells the researchers

00:34:40.400 --> 00:34:44.160
how much unpredictability
is present across millions

00:34:44.160 --> 00:34:47.360
of measurements, but it doesn't
give them a neat sequence

00:34:47.360 --> 00:34:50.720
of evenly balanced,
independent, random bits.

00:34:50.720 --> 00:34:53.680
So they need a way to get
that unpredictability out.

00:34:53.680 --> 00:34:55.120
The basic idea is similar

00:34:55.120 --> 00:34:58.720
to the one Von Neumann
proposed in the same 1951 paper

00:34:58.720 --> 00:35:00.960
as his state of sin joke.

00:35:00.960 --> 00:35:03.760
You flip a coin twice.

00:35:03.760 --> 00:35:06.720
If you get heads, then
tails, you call that a zero.

00:35:06.720 --> 00:35:09.840
And if you get tails and then
heads, you call that a one.

00:35:09.840 --> 00:35:13.360
And if both flips match, then
you just throw them away.

00:35:13.360 --> 00:35:15.120
Even if the coin is biased, as long

00:35:15.120 --> 00:35:16.800
as the flips are independent

00:35:16.800 --> 00:35:19.600
and the bias doesn't change, heads, tails,

00:35:19.600 --> 00:35:21.920
and tails heads are equally likely.

00:35:21.920 --> 00:35:24.400
So what's left is perfectly fair.

00:35:24.400 --> 00:35:26.800
You just end up with a shorter sequence.

00:35:26.800 --> 00:35:29.120
Now, NIST technique is far more powerful,

00:35:29.120 --> 00:35:31.120
but the basic idea is similar.

00:35:31.120 --> 00:35:34.720
The Bell test certifies
at least 820 bits worth

00:35:34.720 --> 00:35:37.440
of unpredictability in
the raw measurements.

00:35:37.440 --> 00:35:40.400
And then using a mathematical
technique called randomness

00:35:40.400 --> 00:35:43.440
extraction, the researchers
concentrate that down

00:35:43.440 --> 00:35:45.680
to just 512 bits.

00:35:45.680 --> 00:35:48.160
- Every one of the measurements

00:35:48.160 --> 00:35:50.480
that we make contributes to every bit.

00:35:50.480 --> 00:35:52.240
- And unlike the random numbers

00:35:52.240 --> 00:35:54.000
that we've seen throughout the video,

00:35:54.000 --> 00:35:56.640
these aren't just difficult to predict.

00:35:56.640 --> 00:35:59.360
Their unpredictability
can actually be certified.

00:35:59.360 --> 00:36:02.400
So this is the closest
you can get to random.

00:36:02.400 --> 00:36:05.200
- Albert Einstein, his argument was

00:36:05.200 --> 00:36:07.200
God does not play dice with the universe.

00:36:07.200 --> 00:36:09.680
That's this famous Einstein quote.

00:36:09.680 --> 00:36:11.920
And Einstein was wrong about that.

00:36:11.920 --> 00:36:14.640
In fact, these experiments
that we do here that show

00:36:14.640 --> 00:36:19.040
that really, you know, this
predictable nature, this kind

00:36:19.040 --> 00:36:21.600
of deterministic worldview that
we have in classical physics

00:36:21.600 --> 00:36:25.040
that Einstein espoused really is

00:36:25.040 --> 00:36:26.480
incompatible with quantum mechanics.

00:36:26.480 --> 00:36:29.200
- Yeah.
- So if God does play&nbsp;

00:36:29.200 --> 00:36:30.640
dice with the universe, then

00:36:30.640 --> 00:36:32.320
what do those dice look like?

00:36:32.320 --> 00:36:33.840
And it's this experiment.

00:36:33.840 --> 00:36:36.320
You know, this is like God's
dice that we're throwing.

00:36:36.320 --> 00:36:39.840
This is the most random source
of entropy you can generate.

00:36:39.840 --> 00:36:42.040
- So God's dice are not loaded.

00:36:42.040 --> 00:36:45.120
- God's dice are not
loaded. Exactly. Yeah.

00:36:45.120 --> 00:36:46.720
So this is something that, you know,

00:36:46.720 --> 00:36:49.440
nothing in the universe could
have predicted in advance.

00:36:49.440 --> 00:36:52.080
- Together with the University
of Colorado Boulder,

00:36:52.080 --> 00:36:57.120
NIST actually publishes this
on random.colorado.edu, along

00:36:57.120 --> 00:36:58.800
with the information
that you need to trace

00:36:58.800 --> 00:37:01.120
and verify how the numbers were generated.

00:37:01.120 --> 00:37:02.960
So you can go and use them if you want.

00:37:02.960 --> 00:37:04.160
These numbers have been shared

00:37:04.160 --> 00:37:08.080
and I can really use the, the
bits that are generated here

00:37:08.080 --> 00:37:10.240
to choose whether I'm
wearing, I don't know, a green

00:37:10.240 --> 00:37:13.040
or a red sweater, and I'll
be using these entangled

00:37:13.040 --> 00:37:14.240
photons to, to do so.

00:37:14.240 --> 00:37:16.160
- And I'm colorblind,
so it'll look the same

00:37:16.160 --> 00:37:18.320
to me if you were a red and green sweater,

00:37:18.320 --> 00:37:20.640
but producing the
randomness was really hard.

00:37:20.640 --> 00:37:22.160
It's like, it takes a lot of equipment.

00:37:22.160 --> 00:37:25.200
You've seen that today. We've
figured out this process of

00:37:25.200 --> 00:37:26.800
how we actually interconnect

00:37:26.800 --> 00:37:29.280
and weave these different systems together

00:37:29.280 --> 00:37:30.800
and these different beacons together

00:37:30.800 --> 00:37:34.560
and sources of randomness can
kind of actually form a layer

00:37:34.560 --> 00:37:36.000
of additional security.

00:37:36.000 --> 00:37:37.840
So yeah, I guess the,
the thing that we hope

00:37:37.840 --> 00:37:39.000
to randomize is the internet.

00:37:39.000 --> 00:37:41.440
- That's awesome.
- That's my ultimate dream is, you know,

00:37:41.440 --> 00:37:46.120
can we just make everything more secure?

00:37:46.120 --> 00:37:51.280
- Okay. One last thing. Last
year we launched the official

00:37:51.280 --> 00:37:52.880
Veritasium trivia game.

00:37:52.880 --> 00:37:54.400
It's called Elements of Truth.

00:37:54.400 --> 00:37:58.080
It's a game with 200 questions
about science and technology,

00:37:58.080 --> 00:38:00.400
but it's not just about
getting the answer right.

00:38:00.400 --> 00:38:02.320
See, there's a confidence
mechanic in the game

00:38:02.320 --> 00:38:04.960
where you have to put
down a point between one

00:38:04.960 --> 00:38:06.400
and 10 on your answer.

00:38:06.400 --> 00:38:08.320
So even if you do get the question right,

00:38:08.320 --> 00:38:11.440
you may lose out on points
if you're doubting yourself.

00:38:11.440 --> 00:38:13.760
The team has been play testing
this when we get together

00:38:13.760 --> 00:38:15.440
and it has been super fun.

00:38:15.440 --> 00:38:18.160
If you miss the Kickstarter,
I'm so excited to announce

00:38:18.160 --> 00:38:19.760
that it's now available.

00:38:19.760 --> 00:38:21.760
If you're interested, we put
a link in the description

00:38:21.760 --> 00:38:23.520
to the Elements of Truth website.

00:38:23.520 --> 00:38:25.280
So thank you for supporting this project

00:38:25.280 --> 00:38:27.240
and as always, thanks for watching.

00:38:27.240 --> 00:38:30.160
- And the way that it works is

00:38:30.160 --> 00:38:36.315
that... no,

00:38:36.315 --> 00:38:38.840
- No.
Come out, come up here.

00:38:38.840 --> 00:38:42.240
- No. I don't think I should die.

00:38:42.240 --> 00:38:44.880
I don't think I should die.
I don't think I should die.

00:38:44.880 --> 00:38:46.400
I'll be fine.

