RNG

One of the ideas that Nick and I had for the book was to record the story of us creating a random number generator which would enable people to create a random sequence in which they could read the chapters of the book.

We thought it would be fun. We also thought it might be quite a challenge, something worth writing about.

One of the early conversations I had about the book was with someone who had invented a random number generator which used the noise from a PC soundcard as a source of entropy.

I figured we could use the entropy of a PC or phone’s camera to achieve the same outcome. And then we could point the device at the fortune-telling fox I bought in Japan last year. A fox which contains a fortune, but which hasn’t been revealed. A quantum state fortune: it could be both good luck and bad luck for as long at the fortune stays stuck inside the fox.

(It’s a ceramic fox, before you call the RSPCA).

Anyway, to cut what turned out to be a very short story shorter, I prompted Claude like this:

Hi.

I’d like to create an 8-bit random number generator.

It needs to run in a web page.

The web page will analyse 8 random pixels from the camera of the device every second. From those 8 random pixels it will derive 8 bits based on their state at the time of the sample. Those 8 bits will then create a number between 1 and 256.

Does that make sense?

And it came back with this:

This is quite remarkable. But also maybe underplays the amount of work and thinking that went into being able to create that prompt. Which was significant and time-consuming, and involved purchasing a fortune-telling fox in Tokyo last summer and bringing it all the way back to South West London.

Anyway, if you’d like to have a play yourself, it’s here:

https://mattballantine.static.domains/rng/index.html

(Fortune-telling fox not included).

Leave a comment