I like to have a short bath every day. At weekends, especially, the soak tends to be a bit more leisurely, and I have just been listening to my current audiobook, a geeky little number called Humble Pi.
It appealed to me because I’ve always been a bit of a maths geek. It’s basically about maths/engineering cock-ups, where bridges have collapsed etc. The US space programme features a lot. Last time he talked about a bridge between somewhere in Germany and somewhere in Sweden. They agreed a height for the bridge, and started to build half each with the intention of meeting in the middle.
It all went wrong because they agreed on a height, measured above sea level. But each set of engineers used a different reference point as “sea level”, so the two halves of the bridge met but one half was 50cm higher than the other! Things like that tickle me.
Today’s instalment was about random numbers, In particular, how difficult it is to generate truly random numbers.
“Proper” generators will use something physical – nowadays things might rely on quantum physics, for example, because at the quantum level, particles can appear and disappear at random – you can even get usb devices built along these lines. In the 1950’s the UK came up with ERNIE to generate random numbers – based on the length of time it would take a single electron to travel the length of a neon tube, which fitted the technology of the day. Because the path is chaotic, and therefore the distance travelled/time taken by the electron is random.
A cheaper/easier way is to produce something which looks as though it is random, called pseudo-random. It reminded me of one of my biggest programming challenges, many years ago. To produce a “seed” which, to all intents and purposes, was random. Lots of things will produce a seemingly random series of numbers, but they all rely on a seed. If you use the same seed twice, you get the same series of numbers, so the randomness of the seed is the key.
This algorithm took ages. In the end, I combined a bunch of things. The program ran on Windows so I ended up using stuff like mouse movements, and the interval between keystrokes. Even then, it was hard to be random, because trained typists didn’t use the mouse, and typed keys at surprisingly regular intervals. I got there somehow and the algorithm ended up being used by both Barclaycard in the UK, and Chase Manhattan in the USA, as part of their merchant operations. This was mid-nineties, so heaven knows if it is still in use (I can’t imagine so). The product I was working on used an American security library, which was subject to export restrictions, so I ended up going to the USA for the first time to do the work – with the same company I later went back several times, and was granted a visa to work there fulltime, as development lead.
Those were the days…