Citation: Bikos, A.; Nastou, P.E.; Petroudis, G.; Stamatiou, Y.C. Random Number Generators: Principles and Applications. Cryptography 2023, 7, 54. https://doi.org/10.3390/ cryptography7040054 Academic Editor: Josef Pieprzyk Received: 11 September 2023 Revised: 18 October 2023 Accepted: 25 October 2023 Published: 30 October 2023 Copyright: © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). cryptography Article Random Number Generators: Principles and Applications Anastasios Bikos 1,2 , Panagiotis E. Nastou 3,4 , Georgios Petroudis 3 and Yannis C. Stamatiou 1,5, * 1 Computer Technology Institute and Press “Diophantus”, University of Patras Campus, 26504 Patras, Greece; mpikos@ceid.upatras.gr 2 Computer Engineering and Informatics Department, University of Patras, 26504 Patras, Greece 3 Applied Mathematics and Mathematical Modeling Laboratory, Department of Mathematics, University of the Aegean, 83200 Samos, Greece; pnastou@aegean.gr (P.E.N.); petroudisgeorgios@gmail.com (G.P.) 4 Center for Applied Optimization, University of Florida, Gainesville, FL 32611, USA 5 Department of Business Administration, University of Patras, 26504 Patras, Greece * Correspondence: stamatiu@ceid.upatras.gr Abstract: In this paper, we present approaches to generating random numbers, along with potential applications. Rather than trying to provide extensive coverage of several techniques or algorithms that have appeared in the scientific literature, we focus on some representative approaches, presenting their workings and properties in detail. Our goal is to delineate their strengths and weaknesses, as well as their potential application domains, so that the reader can judge what would be the best approach for the application at hand, possibly a combination of the available approaches. For instance, a physical source of randomness can be used for the initial seed; then, suitable preprocessing can enhance its randomness; then, the output of preprocessing can feed different types of generators, e.g., a linear congruential generator, a cryptographically secure one and one based on the combination of one-way hash functions and shared key cryptoalgorithms in various modes of operation. Then, if desired, the outputs of the different generators can be combined, giving the final random sequence. Moreover, we present a set of practical randomness tests that can be applied to the outputs of random number generators in order to assess their randomness characteristics. In order to demonstrate the importance of unpredictable random sequences, we present an application of cryptographically secure generators in domains where unpredictability is one of the major requirements, i.e., eLotteries and cryptographic key generation. Keywords: random number generation; entropy source; cryptographic key generation; randomness test; cryptograpically secure pseudo random number generator; cryptography 1. Introduction Is there a method to generate a sequence of truly random numbers? Can we really prove that a sequence of numbers is really random? For instance, which of the following two 26-bit sequences is “random”? Sequence S 1 : 10101010101010101010101010. Sequence S 2 : 01101011100110111001011010. By which criteria, however? Without a precise definition of “randomness”, no math- ematical proof of randomness can be attained. “Intuition” is, often, not sufficient, and it may also be misleading in trying to precisely define “randomness”. Some “randomness” viewpoints that have been proposed in the literature include the following: A process generated by some physical or natural process, e.g., radiation, resistor or semiconductor noise (the practitioner’s view). A process that cannot be described in a “few words” or succinctly (the instance or descriptional complexity view)—the smaller the description of a sequence of bits can be made, the less random it is (try to apply this to the two sequences above). Cryptography 2023, 7, 54. https://doi.org/10.3390/cryptography7040054 https://www.mdpi.com/journal/cryptography