It is well known that digital computers are incapable of creating truly random numbers. The best we can get from digital computers is "pseudo"-random numbers, and the extent of their randomness depends on how careful we are in using them. To get a truly random number, you need a quantum device. Such devices exist, but they have yet to show up on PCIe cards. There are photonic devices capable of generating in excess of a billion truly random numbers per second, and the randomness of these devices has been measured down to 76 decimal places (twice the resolution of 128-bit floating point math). Why do we need random numbers, if we're trying to get a deterministic answer? Well... first of all, there's no such thing as a deterministic answer. Everything in this universe is stochastic, that's just the way it is and there's no getting around it. The prototype use case for consumption of random numbers is the Monte Carlo simulation. An example of it is the original Hopfield network, which used Monte Carlo to select the next neuron to be updated. Most programming languages have routines that allow you to generate random numbers from distributions, and offer a selection of simple distributions. A solid understanding of statistics is essential for neuroscience (so add that to the list of required job skills).
How Do We Create Random Numbers?
Pseudo-random numbers in digital computers are usually created on the basis of a "seed". The seed is used to control the reproducibility of a simulation. With most algorithms, starting from the same seed will generate the same sequence of random numbers, every time. Some people don't want that, so they go to great lengths to fudge the seed, like they use the current date and time, shift it over by a few bits, multiply it by the version number of the operating system, then allocate a variable and use its address to further permute the seed. No matter how clever the programmers get, the resulting stream of digits is still not completely random. All they're doing is obfuscating the seed, and there are algorithms that can recover the seed from the sequence of random outputs.
However the randomness in 64 bits is enough for many purposes. To get better than that, we can use more bits, or we can move to a quantum device. The quantum level is the one and only place in the universe where we find true randomness. Translating that to bits in wires, is a challenge, but recent advances in materials have made it possible. There are even devices that directly incorporate quantum randomness into observable physics, such as memristors and the Chua oscillators mentioned earlier. Generally, we need as much randomness as we have bits. A 64-bit algorithm suffices in a 64-bit machine. The biggest issue with random numbers is the time it takes to generate them, that is to say, how fast and efficient the algorithms are. Generating a random number is much slower than adding two numbers together, because the latter operation takes place in a single compute cycle inside the CPU, whereas invoking an algorithm requires a stack frame and other overhead.
Is There A Faster Way To Do It?
No. Next question? |