THE ILLUSION OF RANDOMNESS: A VISUAL AND SCIENTIFIC ANALYSIS OF PSEUDORANDOM NUMBER GENERATORS

Authors: Luka Baklaga
Affiliation: Business and Technology University

Category:

Keywords: cryptography, Pseudorandom, cryptography, CSPRNG, Entropy, Randomness, quantum security
ABSTRACT. One of the most crucial aspects of cybersecurity and privacy is the concept of randomness. More specifically, in the modern cybersecurity environment, the generation of unpredictable numbers is a foundational requirement. Despite its importance, the significant difference between generators suitable for statistical modeling and those secure enough for cryptography is often misunderstood. The goal of this paper is to provide a practical demonstration of this difference and to highlight the issue of misleading randomness, which is critical for future cryptographic algorithms such as post-quantum cryptography, quantum cryptography, and others where true randomness is essential. The paper presents a practical and contemporary demonstration of a classic security principle. We conducted a simple experiment to showcase how randomness can be as illusory as its cryptographic properties. We compared three well-known generators: a classic Linear Congruential Generator (LCG), Python's standard random module (Mersenne Twister), and Python's cryptographically secure secrets module. By creating separate classes for each module to generate byte streams, visualizing these streams as bitmap images, and subjecting them to Chi-Squared analysis, we reveal a crucial insight: even when a visually patterned and predictable generator passes statistical tests for uniformity, its core security principle is compromised, rendering it dangerously insecure. The results provide a powerful, tangible demonstration of why statistical uniformity is a necessary but insufficient condition for security, and why purpose-built cryptographic modules are indispensable.

References:

Knuth, D. E. 1997. "Random Numbers." In The Art of Computer Programming, Volume 2: Seminumerical Algorithms, Third Edition. Reading, MA, USA: Addison-Wesley.
Rukhin, A., Soto, J., Nechvatal, J., Smid, M., Barker, E., Leigh, S., Levenson, M., Vangel, M., Banks, D., Heckert, A., Dray, J., and Vo, S. 2010. "A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications." NIST Special Publication 800-22 Revision 1a. Gaithersburg, MD, USA: National Institute of Standards and Technology.
Schneier, B., Ferguson, N., and Kohno, T. 2010. "Randomness." In Cryptography Engineering: Design Principles and Practical Applications. Hoboken, NJ, USA: Wiley.
US-CERT. 2008. "Debian OpenSSL predictable random number generator." Vulnerability Note VU#970105.
Patidar, V., and Singh, T. 2025. "A novel approach to pseudorandom number generation using Hamiltonian conservative chaotic systems." Front. Phys. 13: 1553389. doi: 10.3389/fphy.2025.1553389.
Bhattacharjee, K., and Das, S. 2022. "A search for good pseudo-random number generators: Survey and empirical studies." Computer Science Review 45: 100471.