I know that there are many algorithms to generate pseudorandom numbers but is it possible to generate truly random numbers using a computer program?
|
This is a good question, but to dig into it we have to look at the underlying assumptions. First, for the purpose at hand, it doesn't really make sense to say that a number itself is random. There is a sense of a particular number being random from Kolmogorov complexity, but that is not what is intended here. Instead, what we are interested in might be called a random process - a process that generates a sequence of numbers so that the sequence satisfies some particular probability distribution. We want to know if a computer can generate a sequence of numbers in a random manner. The next question is what we mean by "using a computer program". If we take a "computer program" to be a completely deterministic algorithm, then it will not be able to generate numbers in a truly random manner. There is no computer program which could be simulated entirely by paper and pencil - deterministically - which generates numbers in a random manner. The next number in the sequence is always completely predictable! However, if we are willing to add additional hardware, then it might become able. This is a broader notion of "program". For example, the machines used to draw winning numbers for a lottery are designed, essentially, to try to generate numbers in a random manner. There is no reason that one of these could not be connected to a computer and automated. So, if we accept that the lottery can generate numbers randomly, so can a computer. There are faster methods, as well. Some operating systems try to gather random information from the environment, store this information, and then return it when asked to generate a random number. This is not a deterministic process, but theoretically it does generate numbers in a random manner. For example, the computer can measure white noise, or can measure the timing of various events like keystrokes and packet arrivals, and combine these in a theoretically valid way to generate numbers randomly. The final issue is philosophical. Some might believe that the entire universe is deterministic, and therefore nothing is ever random. However, that objection is too far removed for the present conversation. If we want to ask whether computers can generate numbers in a random manner, we normally take it as a given that something could generate numbers in a random manner, so that we can focus on whether computers can do so. |
|||||
|
After searching the Internet, I have decided to answer my own question here. It is possible to generate truly random numbers. Random numbers are generated from random unpredictable processes like thermal or atmospheric noises, cosmic radiations, etc. We need special hardware or sensors which can measure such processes and there could be a program which can produce a number from the input of random events. As this method uses random events rather than a pre-defined algorithm, it can generate a truly random number. You can find one such online solution at https://www.random.org/. Random.org uses atmospheric noise to create randomness. Finally, here is a joke: |
|||||||||||||||||
|
Yes from a theoretical point of view, not from a practical point of view. It is possible with a program accessing the wifi module in off-the-shelf computers. The idea behind this is described here: The random changes in noise level are recorded. This noise is generally accepted as being random (just turn your AM radio to some unoccupied frequency at daytime and listen to the noise the atmosphere produces. The same happens on the ~2 GHz frequencies our wifi modules operate on.). I think they follow some kind of poisson process, so the time between noise changes follows some exponential distribution. Maybe one could also use turning objects like the cooling fan or the hard disk as some kind of wheel of Fortune since their rotation speed can be controlled and recorded by software. However, such random numbers tend to have one big drawback: You don't know their true distribution. So they are useless for most applications, except if you take the random number to seed a ordinary pseudo random number generator (pRNG). Then the resulting pseudo random numbers are a bit less "pseudo" but still have a known (frequency) distribution. Sources of useful randomness with a better understood distribution usually need devices that are no longer part of usual computers. Such devices need to comply to narrow specifications in order to produce the desired probabilities. Usual computers do not: You don't know how much your cooling fan's bearing is worn-out, which random noise your wifi actucally receives etc. Another downside: Generating real random numbers is much slower than pRNGs are, even if you have a specialized device that observes some radioactive decay in order to produce random numbers. So you may end up again with producing only the seed for the pRNG at random. |
|||||||||
|
I do know of one tool that uses radioactive decay to generate true random numbers, found here. Generating true randomness from a simple computer with no extra hardware is not possible to my knowledge. |
|||||||||||||
|
Yes there are random events. Yes you can use a computer with a computer program to measure these and translate them to numbers. This way you can have your program outputting truly random numbers The philosophical question would be: would you have a computer program generating random numbers or a: "phenomena measuring" program where the phenomenon happens to have a random factor. Because your computer program is definitely not generating randomness, it's merely using it. |
|||||||||
|
The answer is no, but you first need to give a precise definition of randomness. I suggest you to read the wikipedia entry Algorithmically random sequence. If you use Martin-Löf's definition (a sequence is random if there is a uniform bound on the compressibility of its initial segments), it can be proved that no random sequence is decidable, computably enumerable, or co-computably-enumerable. |
|||||||||||||||||||||
|
Anyone with some I/O programming skills would be able to generate it. Not intending to patent it :-( therefore, every time you need a random number run the following algorithm:
UPDATE: For a truly random number, create a background worker and repeat this algorithm in an infinite loop. However, this time use the live streaming from your device (or attached) microphone and not a record. Therefore any time someone interrupts you he will actually help you by providing (unexpected) noise. The same happens if your neighbor call his son, or close is car dor. Present moment cannot be repeated absolutely. This even solves the problem of needing many random numbers. |
|||||||||
|
Yes, but there must be some random input. For example, the program can ask the user for a random number and then print it to the screen. Most of the other answers are sophisticated variants on this. A deterministic Turing machine with a given "input" (initial tape, state of memory or whatever it is) will not generate random numbers. |
||||
|
For truly random testing, I like to use online services. random.org uses atmospheric noise to generate random numbers and strings. They even have an API you can tie into (which does have a limited number of times you can call the API). You can use their free services to get a small data set for testing. There's also paid services like randomapi.com, but I personally haven't tried them. |
|||
|