Getting a random figure between one and six is as easy as rolling a dice, but computers find it very difficult to generate a truly random number – they're built on maths and logic, and very often use complex equations to create the impression of randomness.
But researchers have now developed a new algorithm that they hope will help to make the random numbers generated by computers truly random – an important factor in the digital security protecting our phones and other devices.
"Every electronic device needs randomness and needs a lot of it," one of the researchers, Marcin Pawłowski from the University of Gdańsk in Poland, told Lisa Zyga at Phys.org. "Randomness is necessary whenever you need security. Whenever you want secure communication, a cryptographic key must be generated. It has to be generated randomly so that no adversary can easily guess it."
So if your numbers aren't genuinely random, someone else can work out the pattern, and that's a problem when you're trying to encrypt data.
To generate a real random number, a piece of software needs some kind of unpredictable physical input as a 'seed' – it could be anything from the pattern of typing on a keyboard, to the atomic decay of an atom.
The new algorithm developed by Pawłowski and colleagues from Poland, Sweden, and Brazil focusses on that physical type of input and tries to eradicate any kind of detectable pattern from the devices used to measure it. Simply put, it tries to strike a balance between complexity and speed in terms of the number-crunching involved.
Based on the team's testing, the approach they've devised can certify a greater level of randomness than ever before, and at a faster speed too. What's more, it works in cases where other methods don't work at all.
The main trick the new algorithm pulls off is being able to adjust the trade-off between available computing power and the strictness of the tests used to verify the randomness of the numbers. That may not sound like much, but it means more random numbers that are really random – and better security for our devices.
"We are now trying to prove [the system works in multiple scenarios] and see in which situations it is most useful," said Pawłowski. "Our second goal is to try to reduce the time of computation required for certifying more randomness. We have some preliminary results here too, which suggest it can be done."
The research has been published in the New Journal of Physics.