What is a random number generator? It's just a few lines of code, and in some programming languages, just one. Surprisingly, in 1957, a random number generator occupied a small space because a special computer was built for this purpose. And it wasn't built for no reason; it was designed to solve an important practical problem. Thomas Flowers is the man who created computational machines during World War II to decipher secret messages from the German army. He was a developer, by the way. But let's take it step by step.
The Chancellor of the Exchequer in the United Kingdom, Harold Macmillan, in 1956 pondered ways to slightly improve the well-being of Her Majesty's subjects and replenish the state treasury. The result of his contemplation was the introduction of so-called "premium bonds". Unlike regular government securities, premium bonds did not offer any fixed coupon income. Instead, their holders became participants in a monthly lottery, where the interest on these bonds and numerous cash prizes were drawn. The prize amounts ranged from £25 to £1,000,000, and the income obtained in this way was tax-free. A bond could participate in monthly drawings 30 days after its purchase and up to the date of its redemption, and the government undertook to redeem these securities at face value upon their expiration.
This original investment instrument was ceremoniously introduced on the London Stock Exchange on November 1, 1956, and the very first premium bond was purchased by the Lord Mayor of London, Sir Cuthbert Ackroyd, from the Postmaster General, Dr. Charles Hill, enriching the British budget by £1. The innovation was well-received by the residents of Albion, and soon premium bonds became consistently popular. By the end of 1956, around 50 million bonds had been sold, each with a unique serial number. To this day, more than 24 million Britons own these securities.
During the lotteries that determined the lucky winners, many serial numbers of winning bonds had to be randomly chosen in a way that left no doubt about the impartiality of the algorithm. After all, we were talking about millions of pounds. In other words, simple lotto machines with numbered balls were insufficient. The British government decided to build a special Lottery Computer for these purposes, one that would efficiently solve such a complex task. It was then that officials remembered the talented engineer Thomas Flowers, considered one of the most advanced computer scientists in England in 1956. Moreover, he had previously worked successfully for the British government, not just any government, but the Ministry of Defense and military intelligence.
Non-random Randomness
It is well known that numbers generated using functions like "rand();" in C++ are called "pseudo-random" And the prefix "pseudo-" is not without reason. The sequence of such numbers has all the properties of randomness, but it is formed according to a certain mathematical algorithm, subject to a series of regularities, and the generator itself has a limited number of internal states. Because of this, over sufficiently large time intervals, the sequence of numbers generated by such a generator may repeat.
For generating the numbers of winning bonds in the state lottery, a device was needed that could produce genuinely random sequences that could not be predicted even knowing the algorithm. Moreover, in the case of premium bonds with multi-digit serial numbers, there was a need to generate up to 100 million random values during each drawing. In other words, the British government needed a random number generator on an industrial scale.
The task of inventing such a machine was entrusted to Thomas Flowers and the engineer Harry Fensom, who joined him, both working at the research laboratory of the postal service in Dollis Hill. To save time and effort, Flowers based the new computer on the well-established Colossus, a development he had worked on during the war. The only thing needed was to add the most crucial component — a random value generator, with the randomness based on some chaotic physical process, the outcome of which could not be predicted in any way. But what process to use?
"There's a neon light inside it!"
After careful consideration, Flowers decided to build the generator based on lamps filled with neon. These lamps emit a beautiful red light, but their main feature is not that. When a high voltage is applied to a neon lamp, it generates an electric current inside, created by the flow of charged particles between the electrodes. Along the way, electrons collide with neon atoms, making their movement trajectory chaotic, resulting in an electric current of random magnitude. This signal, passed through an amplifier, was fed to the pulse generator. Flowers' devised scheme produced up to 3000 electrical impulses per second, and each second, the quantity of these impulses varied. The resulting construction served as a "noise" generator for the computer.
Schematic of Flowers' "Noise" Generator
The number of pulses generated by the scheme fluctuated around a certain average, making it unsuitable for use as a truly random number. Instead, the computer extracted the least significant bit from the counted pulses and passed it to the "ring counter", which performed a modulo operation by 6, 10, or 24. The counter started counting from a different value each time, adding an extra element of randomness to the result. The counters were controlled by pulses from the noise generator. In essence, this entire system operated as an equivalent of a spinning roulette wheel in a casino — where the roulette stopped, a random number was obtained.
The computer was named ERNIE (derived from "A Random Number Generator"). Since the bond's serial number consisted of 7 digits and two letters, the computer used nine-ring counters in its design. Seven of them generated digits from 0 to 9, and the last two randomly output one of 22 values corresponding to English alphabet characters (the letters 'O', 'I', and 'U' were not used in bond numbers). To avoid a situation where the obtained number would not be truly random due to a neon lamp burning out, Flowers duplicated all the "neons" in the ERNIE design and mounted them on the board in pairs. The serial numbers obtained during its operation were printed on a teletype tape.
ERNIE could generate one random number for a winning bond every two to three seconds, totaling about 2000 numbers per hour. During the first draw, the computer-generated 60,000 serial numbers, allowing the selection of only 23,000 winners. The difference is explained by the fact that the serial numbers of premium bonds were not consecutive — there was a significant number of numbers that did not correspond to sold securities. All selected ERNIE numbers were carefully verified by the actuarial department of the UK government (an actuary is an expert in economics and finance, addressing issues of financial security and risk assessment). The purpose of the verification was to ensure that the numbers were genuinely random and that there were no manipulations or fraud during the draw. In other words, the British approached the matter seriously, with truly precision. The ERNIE machine itself, by the way, cost the royal treasury £25,000, but these expenses were more than justified and quickly recouped.
Robots work hard, and humans rejoice
The idea of conducting draws using computers appealed to the British — such a bright manifestation of technological progress in 1957 seemed like real science fiction. The ERNIE machine itself became an element of local folklore. The British wrote letters to it and sent Christmas cards, and souvenir shops sold porcelain piggy banks shaped like a cute robot named ERNIE and trinket boxes in his likeness — it was believed that if you kept bonds in such a "statuette," the owner would be lucky, and they would surely turn out to be winning.
The inscription on the trinket: «Ernie’s Lucky Bond Box"
Meanwhile, technological progress continued, and Flowers gradually improved the design of his machine. In 1972, the second version of ERNIE was introduced, incorporating transistors and interchangeable modules in the form of separate printed circuit boards. In 1988, it was replaced by ERNIE III, the size of a standard personal computer. With this computer, each monthly draw took five and a half hours.
In 2004, ERNIE IV, developed by LogicaCMG, succeeded it. This machine no longer used neon lamps—the random number generator operated based on thermal noise in transistors. ERNIE IV's performance was 500 times higher than the original—the computer generated a million bond serial numbers per hour.
The latest version of ERNIE to date, labeled ERNIE V, was created by ID Quantique and was put into operation in March 2019. This computer is built on a quantum random number generator, utilizing technology to obtain random values using light, replacing the previous "thermal noise" method. ERNIE V operates 21,000 times faster than the very first ERNIE model and can determine three million lottery winners in just 12 minutes.
As for the very first ERNIE computer built by Thomas Flowers, it is currently displayed as an exhibit in the Science Museum in London. It's a rare case where a specialized computing machine, based on military technologies used in the construction of Colossus, has survived through several generations to the present day and, notably, continues to excel at its assigned tasks.
This article is written by Techical Editor Valentin Holmogorov and supported by the Serverspace team.
Serverspace is an international cloud provider offering automatic deployment of virtual infrastructure based on Linux and Windows from anywhere in the world in less than 1 minute. For the integration of client services, open tools like API, CLI, and Terraform are available.
Top comments (0)