Asked by: Will Harrison, Ipswich
Strictly speaking, there can't be a formula for generating truly random numbers - which by definition follow no law. Even so, all computers use formulas to generate 'pseudo-random' numbers that certainly look pretty random. The formulas are somewhat technical but a very simple one that anyone can use is to divide 1 by 179. The resulting decimal number gives a string of over 170 random digits.
Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun science facts.