# How do computers generate random numbers 3

## Mathematics: How does chance get into the PC?

Random numbers are also needed for many other purposes, such as simulating car traffic or the weather in a computer. However, choosing a random number is difficult for a computer. Computers are obedient arithmetic servants: they carry out a calculation exactly as it was previously specified. They don't deviate by a millimeter unless the computer is defective.

Lotto with the computer would be boring: every week we would have the same result. Or is it possible to generate a sequence of random numbers with a computer program?

Well, true random numbers in the strict mathematical sense cannot actually be generated with a computer - but at least so-called pseudo-random numbers. These are sequences of numbers that, according to statistical tests, look random. They are not really random, but they are so “mixed up” that they are nevertheless suitable for computer simulations.

John von Neumann, a mathematical genius and one of the first to calculate with computers, invented a simple method for generating pseudo-random sequences. Take, for example, a ten-digit decimal number. If this number is squared, the result is an approximately 20-digit number. Now take the middle ten decimal places. This is the first pseudo random number. Then you repeat this process over and over again: square again, take ten places from the middle, and so on. Each time a new pseudo-random number is created. This procedure does not work with every starting number, but with certain starting values the results look really chaotic.

Another method for generating pseudo-random numbers by computer is the so-called congruence method by Lehmer. It has already been used on Eniac, the world's first electronic computer. As with the Von Neumann method, you start with a number. This is multiplied by 23 and then by 10 ^{8} +1 (100 million plus one) divided. The remainder is the first pseudo-random number. You start the next bill with it - and so on. The sequence of numbers generated in this way has good statistical properties, that is, it looks random.

The methods mentioned are easy to implement in a computer or even a calculator. Basically, the more decimal places are used, the more random the sequence of numbers looks.

*The author is a professor of computer science at the Free University of Berlin. His specialty are artificial neural networks.*

More math columns on the web:

www.jahr-der-mathematik.de

welt.de/mathematik

- Is phantom pain painful
- How does mayonnaise kill Laeuse
- What are the causes of rolling friction
- How do the Chinese on the mainland see the Americans
- Where did the Indians come from?
- What prevents play
- Is Mountain Dew the most unhealthy soft drink
- Is there poverty in the US?
- How can I start a digital agency
- What is the Objective C programming language?
- How is religion politicized in Indonesia
- What is your favorite porn picture
- What is more important people or money
- Is cancer curable in the last few days
- What was a lesson you learned
- When did Islamic terrorism begin?
- Can you trust Huawei Honor phones 1
- How do people smell like cats
- Uses Google SQL databases
- How is asbestos broken down
- Love gay men, female gay men
- How can I delete a Badoo account?
- Why is Fortnite so popular
- How lamb is usually cooked