0
0 Votes

# How can a computer create random numbers?

Question by Guest | 04/01/2012 at 18:37

I wonder, how it is possible for computers to generate random numbers. Normally, I would think, as a layman, that a computer always works exact and accurate and a mathematical function always provides a predictable result. So, where are the numbers from the random number generator coming from?

ReplyPositiveNegativeDateVotes

Reply

## Related Topics

## Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

## Participate

Ask your own question or write your own articles on askingbox.com. How to do.

## Guest

Show ProfileThere are different ways, how a computer can proceed. First, there are so-called pseudo-random number generators. They just use a list of previous defined random numbers from which just a number is selected. Of course, that is not truly random and there is the problem, that the numbers forcibly repeat sometime, depending, of course, on the length of the list.

Better results are obtained with a different class of random number generators, which are processing certain "random" values from the computer to derive random numbers from them. This can be, for example, the computer's clock in milliseconds, that is constantly changing, or the moving of the mouse, or the noise of a sound input or a card attached to the computer. The resulting values are relatively unpredictable and thus lead to very good results, which look pretty random, after being chased by a corresponding function.

To test how good a random function is, it can be called a million times, to then look at the distribution of the output values. Here, the distribution should be quite equal and there should occur no unexpected spikes or depressions at certain values.

05/01/2012 at 19:59

## Computer Expert

Show Profile | MessageThere are mathematical functions that already vary enormously with small changes in the values of the parameters. If you put in these functions, for example, the system time as an initial value, quickly the whole range of values is uniformly covered and we get our random number by scaling to the desired range.

06/01/2012 at 21:34