Think of a random number. Now, think of a second one.

You already failed, because the numbers you chose weren’t really random, mathematically speaking. Compared to a truly random sequence generator, research has shown that humans are less likely to pick the same number twice in a row and more likely to create patterns in the sequences they choose. But don’t feel too bad for yourself—your computer can’t generate truly random numbers, either. This has proven to be an issue for slot machines, which are controlled by automated pseudorandom number generators and susceptible to hacking.

Now, chemists have, for the first time, harnessed another natural source of randomness: chemistry. These scientists built a robotic system that uses the process of crystallization to create random strings of numbers and encrypt information. They published a study with their findings on Monday in the journal Matter.

“We took the word 'crystal!' and we encoded it using our random number generator. And we also used a well-known algorithm,” said Lee Cronin, the senior author of the study and a chemistry professor at the University of Glasgow. “We found our messages encoded with the genuinely random numbers took longer to crack than the algorithm, because our system could guess the algorithm and then just brute force it.”

Here's how it works: under the right conditions, chemicals in a liquid solution can go from a disordered state to an extremely organized one, otherwise known as a crystal. The process is filled with randomness, from the time it takes for the crystal to form to the geometry of the products.

Growing crystals. Image: Cronin et al.

Cronin and his co-authors designed a simple robot that views an array of crystallization chambers with a webcam and converts some of the features it sees into a string of ones and zeroes. The researchers looked at three different chemical reactions and compared their encoded strings for “crystal!” to one created with the Mersenne Twister, a general-purpose pseudorandom number generator. Once their decryptor figured out the way in which the algorithm generated numbers, the crystallization method took longer to crack.

This method offers an as-good alternative to existing true random number generators, and according to Cronin, his system may even have some advantages, including the potential for indefinite use.

Cronin likened such a device to a reusable chemical hand warmer, which also runs on crystallization. After the hand warmer loses its warmth as it completes the chemical reaction, you can boil it in water to liquefy the crystals and reset the process.

In future experiments, Cronin said that he wants to add extra entropy to the equation by introducing chemical reactions before beginning crystallization. In theory, a hacker could make a copycat chemical random number generator to speed up the decryption of information processed by Cronin’s robot. A system with more randomness could be even harder to decipher, Cronin said.

“The whole idea is to have a random process with a random process with a random process then with a random crystallization. If you put all those together, would you get even better random numbers?” he said.

The robot. Image: Cronin et al.

In the paper, Cronin and his co-authors speculated that a form of their robot could be miniaturized and embedded in a conventional computer, “allowing access to a powerful and convenient random number generator powered by chemical processes.” Cronin added that this method would be cheaper than quantum computing, considered to be the gold standard for random number generation.

Cronin used chemistry to solve a problem in cryptography, but he said that the robot could conversely aid chemistry, from discovering drugs to designing better batteries.