Most random number generators are not truly random. The vast majority of software you interact with daily relies on pseudorandom number generators, which are deterministic algorithms that produce sequences looking random enough to fool casual inspection but are entirely predictable if you know their starting conditions. Genuine randomness, the kind where no amount of information about the past lets you predict the future, requires tapping into physical processes like electronic noise or quantum events. The distinction matters more than most people realize, and the line between “random enough” and “dangerously predictable” has been exploited in ways that cost real money and compromised real security.
What Pseudorandom Actually Means
A pseudorandom number generator starts with a value called a seed, often pulled from something like the current time in milliseconds. From that seed, it applies a mathematical formula to produce a long sequence of numbers that appear statistically random. The sequence passes many tests for randomness: the numbers are evenly distributed, patterns don’t repeat for a very long time, and short stretches look indistinguishable from coin flips. But the process is entirely deterministic. Feed the same seed into the same algorithm, and you get the exact same sequence every time.
This is not a flaw in the design. It is the design. For most everyday computing tasks, pseudorandomness works perfectly well. Video games use it to scatter enemies across a map. Statistical software uses it to run simulations. Spreadsheets use it to sample data. In these cases, the numbers just need to be unpatterned enough that no human or downstream calculation would notice or care about any structure hiding in the sequence. A good pseudorandom generator accomplishes that cheaply and quickly.
The trouble begins when someone with motivation and resources tries to reverse-engineer the sequence. Because the output is deterministic, anyone who figures out the seed or observes enough of the output can reconstruct the entire sequence, past and future. For shuffling a playlist, this is irrelevant. For encrypting bank transactions or dealing poker hands online, it is a serious vulnerability.
Where True Randomness Comes From
True random number generators harvest unpredictability from physical processes that no algorithm can replicate. The most common approach in hardware relies on thermal noise, the tiny, chaotic voltage fluctuations that occur naturally in electronic components like resistors. These fluctuations arise from the random motion of electrons at any temperature above absolute zero, and they are genuinely unpredictable at the level needed for cryptography and security.
Engineers have built circuits that amplify and digitize this thermal noise into streams of random bits. One approach uses a resistor’s thermal noise fed through an analog-to-digital converter; for instance, researchers have demonstrated designs using resistors paired with high-resolution converters on programmable system-on-chip devices, producing random bit streams directly from the noise of internal or external resistors.{1International Journal of Circuit Theory and Applications. A true random number generator that utilizes thermal noise in a programmable system‐on‐chip (PSoC)} Similar thermal-noise-based circuits have been fabricated using standard semiconductor manufacturing processes, making them practical for embedding directly into chips.{2IEEE Xplore. ASIC, 2001. Proceedings. 4th International Conference on}
These hardware generators are slower than pseudorandom algorithms, which can spit out millions of numbers per second with minimal computational cost. A physical noise source needs time to accumulate enough entropy for each bit. This speed difference is why many real-world systems use a hybrid approach: a hardware source generates a seed or periodically refreshes an internal state, and a fast pseudorandom algorithm stretches that seed into a longer usable stream. Your operating system likely does something like this already, blending hardware entropy from things like timing jitter in your processor with a software algorithm to supply random numbers on demand.
Quantum Randomness Is a Different Beast
Thermal noise is unpredictable in practice, but a philosophically inclined skeptic might argue that it is still governed by classical physics and is therefore deterministic “in principle,” even if tracking every electron is impossible. Quantum mechanics removes that objection entirely. At the quantum level, certain events are fundamentally indeterminate. No hidden variable, no deeper theory, no amount of information about the universe’s prior state can predict the outcome of a single quantum measurement. This is not a gap in our knowledge; it is a feature of how reality works, as confirmed by decades of experimental tests of Bell’s theorem.
Quantum random number generators exploit this by measuring quantum events and converting them into bits. One practical method involves shining a dim laser and counting individual photons with a sensitive detector. The arrival of photons from a coherent light source follows a Poisson process, meaning the number of photons detected in any given time window is inherently probabilistic.{3ACS Omega. Quantum Random Number Generation Based on Multi-photon Detection} Other quantum generators measure the random splitting of single photons at a beam splitter, or the vacuum fluctuations in the electromagnetic field. Several companies now sell commercial quantum random number generators, and some are small enough to fit on a single chip.
For most applications, the practical difference between a well-designed thermal noise generator and a quantum generator is negligible. Both produce bits that pass all known statistical tests for randomness. The quantum generator’s advantage is more foundational: its randomness is guaranteed by physics in a way that thermal noise, while practically unbreakable, is not. For extremely high-security applications or for future-proofing against advances in computational power, that guarantee matters.
Creative Physical Entropy Sources
Not all true random number generators need nanoscale electronics or quantum optics. Researchers have experimented with macroscopic sources of chaos that are visible to the naked eye. One recent approach uses turbulent bubbling water illuminated by a light source, capturing the chaotic patterns of refracted light with a camera. The system exploits the compounding unpredictability of bubble formation, turbulent fluid flow, and the ever-changing paths light takes through the churning water. Each of these processes amplifies tiny uncertainties into large, measurable differences in the light pattern, producing a rich source of entropy.{4arXiv. Refracted Light Interaction in Turbulent Bubbling Water (RLITBW): A Macroscopic Fluid-Optic Entropy Source}
This is not as exotic as it sounds. Cloudflare, one of the largest internet infrastructure companies, famously uses a wall of lava lamps filmed by a camera as one of its entropy sources. The unpredictable motion of the wax blobs, combined with variations in lighting and camera sensor noise, provides a continuous stream of random data. The principle is the same in all these systems: find a physical process where small changes cascade into large, unpredictable outcomes, and measure the result.
When “Random Enough” Isn’t
The real-world consequences of weak randomness have been demonstrated repeatedly. One well-known case involved an online poker platform that used a pseudorandom number generator to shuffle its virtual cards. Because the numbers produced by a pseudorandom generator are not truly random and will reproduce the same sequence given the same seed, researchers were able to determine the seed and predict the entire shuffle, meaning they could know every player’s hand before the cards were dealt.{5IGI Global. Building Secure and Dependable Online Gaming Applications} The platform had essentially turned poker into a game of perfect information for anyone willing to do the math.
Similar vulnerabilities have appeared in cryptographic systems. In 2012, researchers analyzing millions of public encryption keys found that a significant fraction shared prime factors with other keys, meaning they could be cracked. The root cause was weak random number generation during key creation, often on embedded devices like routers that had very little entropy available at boot time. The keys were generated before the system had accumulated enough randomness, so different devices ended up choosing from a small pool of “random” values.
Even the gambling industry, which depends on randomness for its regulatory compliance and business model, has faced problems. Slot machines and electronic gaming devices use pseudorandom generators that are certified and audited, but vulnerabilities have occasionally been exploited by individuals who reverse-engineered the algorithms. The pattern is consistent: whenever the stakes are high enough, the distinction between pseudorandom and truly random becomes a practical concern rather than a theoretical one.
Cryptographically Secure Pseudorandom Generators
Because true hardware randomness is relatively slow to generate, security-critical applications often rely on a middle ground: cryptographically secure pseudorandom number generators. These are still deterministic algorithms, but they are designed so that even an attacker who sees a large portion of the output cannot feasibly predict the next number or reconstruct the seed. The mathematical difficulty of reversing the generator is tied to hard computational problems, the same kinds of problems that underpin modern encryption.
The design requirements for these generators are formalized in government and industry standards. Researchers have developed dedicated hardware implementations of cryptographically secure generators, building them as IP cores that can be embedded directly into chips for high-throughput applications requiring both speed and security.{6PubMed Central. Cryptographically Secure Pseudo-Random Number Generator IP-Core Based on SHA2 Algorithm} These generators typically use a hash function like SHA-2 as their core transformation, making it computationally infeasible to work backward from the output to the internal state.
In practice, the security of these systems depends not just on the algorithm but on how they are seeded and maintained. A cryptographically secure generator that starts from a predictable seed, or that never refreshes its internal state with new entropy, can still be vulnerable. The strongest real-world implementations combine a cryptographic algorithm with continuous entropy input from a hardware source, giving them both the speed of software generation and the unpredictability of physical randomness.
Why Humans Are Terrible Judges of Randomness
Even when a random number generator is working perfectly, people often think it is broken. Research in cognitive psychology has consistently shown that human intuition about randomness is systematically biased. When asked to judge whether a sequence looks random, people expect far more alternation than true randomness actually produces. A genuinely random sequence of coin flips will contain long runs of heads or tails that look suspiciously streaky to a human observer. People see patterns and structure in these runs and conclude the sequence must not be random.{7Advances in Applied Mathematics. The perception of randomness}
This bias runs in both directions. When people are asked to produce a random sequence themselves, by calling out heads or tails without actually flipping a coin, they alternate too frequently and avoid the long runs that would naturally occur. The sequences they produce are detectably non-random precisely because they are “too balanced,” switching back and forth more than chance would dictate.
This mismatch between human intuition and actual randomness creates problems in practice. Music streaming services learned this early: when they first implemented truly random shuffle for playlists, users complained that the same artist would come up twice in a row, or a song they just heard would reappear soon. The shuffle was working correctly, but it did not match what people expected randomness to feel like. Most services now use algorithms that are deliberately less random, spacing out repeated artists and genres to create a subjective feeling of randomness that is actually more structured than the real thing.
The same perception problem affects gambling. A roulette wheel that lands on red eight times in a row triggers an overwhelming urge to bet on black, even though the wheel has no memory and each spin is independent. Casinos benefit from this: the belief that a “correction” is overdue keeps players at the table. Understanding that true randomness includes clusters and streaks is one of the most counterintuitive lessons in probability, and most people never fully internalize it.
Random Seeds and Scientific Reproducibility
The deterministic nature of pseudorandom generators is not always a weakness. In scientific computing, it can be a feature. By recording the seed used for a simulation or analysis, researchers can reproduce their results exactly. Anyone who runs the same code with the same seed gets the same “random” numbers and therefore the same outcomes. This reproducibility is essential for verifying results, debugging code, and building on previous work.
But reproducibility has a shadow side. In machine learning, where randomness enters at multiple stages, from how training data is shuffled to how model weights are initialized, the choice of random seed can meaningfully influence the final result. Researchers have shown that varying the seed alone, without changing anything else about the data or analysis, can yield divergent scientific conclusions from the same dataset. In causal inference studies using popular machine-learning-based estimators, different seeds produced estimates that led to different interpretations of whether a treatment worked.{8PubMed Central. Don’t Let Your Analysis Go to Seed: On the Impact of Random Seed on Machine Learning-based Causal Inference}
This is a real methodological concern, not just a curiosity. If a researcher tries dozens of seeds and reports only the one that gives a publishable result, the finding may not be robust. Techniques exist to stabilize results across seeds, and awareness of the problem is growing, but it remains an underappreciated source of variability in published research. The irony is that pseudorandomness, which is entirely deterministic, introduces a form of instability into science precisely because the choice of starting point is arbitrary.
How Your Phone and Computer Generate Random Numbers
Modern operating systems maintain an internal pool of entropy gathered from multiple sources. On a typical computer, these include the precise timing of keystrokes and mouse movements, variations in hard drive seek times, network packet arrival times, and increasingly, dedicated hardware random number generators built into the processor. Intel’s chips have included an on-die random number generator since 2012, and ARM-based processors used in smartphones have similar features.
The operating system collects these entropy sources into a pool, stirs them together with a mixing function, and makes the result available to applications that request random numbers. When you visit a secure website, your browser uses this entropy to help establish the encrypted connection. When an app generates a unique identifier for your device, it draws from the same pool. Most users never think about any of this, which is by design: the system works well enough that randomness is invisible infrastructure.
Where things get interesting is in environments with limited entropy. A freshly booted virtual machine in a data center has no keyboard, no mouse, and no physical hard drive to harvest timing variations from. Its initial entropy pool may be dangerously thin. Early cloud computing platforms ran into exactly this problem, generating cryptographic keys on virtual machines that did not yet have enough randomness available. Solutions have included paravirtualized entropy devices that let virtual machines draw randomness from the host, and protocols like virtio-rng that pipe hardware entropy into guest operating systems.
Embedded devices face similar constraints. A smart thermostat or a security camera typically has no user input and limited hardware variation. If it needs to generate a cryptographic key during its first boot, it may have almost no entropy to work with. This is why some of the most serious randomness failures in recent years have involved Internet of Things devices rather than traditional computers. The devices that most need good randomness are often the ones least equipped to produce it.
Testing Whether a Generator Is Good Enough
Statistical test suites exist specifically to evaluate random number generators. The most widely used is the NIST Statistical Test Suite, developed by the National Institute of Standards and Technology, which runs a battery of tests checking for patterns, correlations, and biases in a sequence of bits. Other suites like Diehard and TestU01 apply their own batteries of increasingly stringent checks. A sequence that passes all tests is not proven to be random, since no finite test can prove true randomness, but failing any test is strong evidence that the generator has a weakness.
These suites catch surprisingly subtle problems. A generator might produce numbers that look perfectly uniform but have a faint correlation between every 37th and 38th output. No human would notice, but a downstream cryptographic application might be weakened. The tests are designed to catch structure that only becomes visible across millions or billions of outputs, the kind of structure that an attacker with enough computational power could potentially exploit.
For certified applications like gambling and government encryption, passing these test suites is a regulatory requirement, not just a best practice. Generators are tested both in design and in operation, with continuous monitoring to catch hardware degradation that might reduce the quality of a physical entropy source over time. A resistor generating thermal noise can age, and its noise characteristics can shift. Catching that before it compromises the output is part of what makes the difference between a laboratory demonstration and a production-ready system.

