Random

Random: Without order. Not able to be predicted. Happening by chance.

It is surprisingly hard to be random!

People can try to pick random numbers, but are quite bad at it.

People

People can be shy about repetition, or overdo it.

Such as these human-made Heads and Tails sequences:

While they are both possible, over a long sequence we should expect:

In a sequence of 100 Heads and Tails it is likely to have a run of 6 (HHHHHH or TTTTTT), and runs of 7 or 8 are also not unlikely.

Very long runs are also possible, just more and more unlikely.

But humans aren't good at that.

Computers

Computers are good at generating numbers that look random numbers, but aren't perfect. We call them pseudorandom numbers.

There are clever ways to generate them.

Example: Use a Function

We want a function that creates a good series of digits. Let's use the sine function!

Start with a "seed", some number to begin with, how about 0.7:

sin(0.7) = 0.6442176872377... (in radians)

And we can be clever and take only digits starting from (say) the 5th decimal place, where they seem unpredictable:

Start:
sin(0.7) = 0.6442176872377...
Repeat:
sin(0.176872377) = 0.1759516106453...
Repeat:
sin(0.516106453) = 0.4934974853431...
And so on!

Giving us the sequence:

0.176872377, 0.516106453, 0.974853431, ...

Repeating

We can create that same sequence by using the same seed (useful in simulations).

We can use the date and time as a seed to get different sequences.

But there's a risk of hitting a loop if a number occurs again in the sequence, repeating that part over and over again.

Also someone may guess our method (algorithm) and crack any code we may use based on the numbers.

In practice computer algorithms are much more complex than simply "sin() and 5th digit onwards".

The Spinner produced this sequence of 100, is it good?

HHHHTHTHTTTHHTHTHTTHTTHHHHTTTHTTTTTTTTHTTHTTTTHTHHHHHHTTTTTHTHTTTHHHTTTTHTHHTHHHHTHHTHTTHHTHTHTHTHHT

Really Random

But to be truly random is hard. Sometimes people use a physical source, such as a transistor that has been burnt in an oven and produces static.

Or this array of Lava Lamps:

lava lamps

The constantly changing shapes are photographed and turned into random numbers.

Related Ideas

Deterministic means there is no randomness: the same starting conditions always lead to the same result.

Stochastic involves randomness, especially when something changes over time.

Example: Going for a walk

  • Deterministic: We walk 2 steps forward every minute. We know exactly where we'll be in an hour
  • Stochastic: We flip a coin every minute: H is move forward, T is move backward. We don't know where we'll be in an hour, but can work out the probability of where we'll be

Entropy: a measure of disorder in a system.

Chaos: This is different! A chaotic system (like the weather) is deterministic, but so sensitive to small changes that it appears random.