Skip to main content icon/video/no-internet

Random numbers are useful for a variety of purposes, such as generating data encryption keys, simulating and modeling complex phenomena, and selecting random samples from larger data sets. They have also been used aesthetically (e.g., in literature and music) and are, of course, ever popular for games and gambling. When discussing single numbers, a random number is one that is drawn from a set of possible values, each of which is equally probable (i.e., a uniform distribution). When discussing a sequence of random numbers, each number drawn must be statistically independent of the others.

There are two main approaches to generating random numbers using a computer. Pseudorandom number generators (PRNGs) are algorithmic approaches that use mathematical formulae (e.g., the linear congruential method) or simply precalculated tables to produce sequences of numbers that appear random. PRNGs are efficient and deterministic, meaning that they can produce many numbers in a short time and a given sequence of numbers can be reproduced at a later date if the starting point in the sequence is known. PRNGs are typically periodic, meaning that the sequence will eventually repeat itself. These characteristics make PRNGs suitable for applications where many numbers are required and where it is useful that the same sequence can be replayed easily, such as in simulation and modeling applications. PRNGs are not suitable for applications where it is important that the numbers be really unpredictable, such as data encryption and gambling.

In comparison, true random number generators (TRNGs) extract randomness from physical phenomena, such as quantum events or chaotic systems. For example, random numbers can be generated by measuring the variations in the time between occurrences of radioactive decay (quantum events) or the variations in amplitude of atmospheric noise (caused by the planet's chaotic weather system). TRNGs are generally much less efficient than PRNGs, taking a considerably longer time to produce numbers. They are also nondeterministic, meaning that a given sequence of numbers cannot be reproduced, although the same sequence may, of course, occur several times by chance. TRNGs have no period. These characteristics make TRNGs suitable for roughly the set of applications for which PRNGs are unsuitable, such as data encryption, games, and gambling. Conversely, the poor efficiency and nondeterministic nature of TRNGs make them less suitable for simulation and modeling applications.

Many statistical tests exist that can be used to assess the randomness of numbers generated with either approach. Examples include the Chi-Square Test, the Run Test, the Collision Test, and the Serial Test. However, testing for randomness is not straightforward, because each possible sequence is equally likely to appear, and good random number generators therefore will also produce sequences that look non-random and fail the statistical tests. Consequently, it is impossible to prove definitively whether a given sequence of numbers (and the generator that produced it) is random. Rather, random numbers from a given generator are subjected to an increasing number of tests, and as the numbers pass more tests, the confidence in their randomness (and the generator that produced them) increases.

...

  • Loading...
locked icon

Sign in to access this content

Get a 30 day FREE TRIAL

  • Watch videos from a variety of sources bringing classroom topics to life
  • Read modern, diverse business cases
  • Explore hundreds of books and reference titles

Sage Recommends

We found other relevant content for you on other Sage platforms.

Loading