# Generate Random Numbers

Perhaps you have wondered how predictable machines like computers can generate randomness. In reality, most random numbers used in computer programs are pseudo-random, which means they are generated in a predictable fashion using a mathematical formula. This is fine for many purposes, but it may not be random in the way you expect if you're used to dice rolls and lottery drawings.

## Generate random numbers

RANDOM.ORG offers true random numbers to anyone on the Internet. The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random number algorithms typically used in computer programs. People use RANDOM.ORG for holding drawings, lotteries and sweepstakes, to drive online games, for scientific applications and for art and music. The service has existed since 1998 and was built by Dr Mads Haahr of the School of Computer Science and Statistics at Trinity College, Dublin in Ireland. Today, RANDOM.ORG is operated by Randomness and Integrity Services Ltd.

Q3.1 in the FAQ explains how to pick a winner for your giveaway for FREE Third-Party Draw Service is the premier solution to holding random drawings online Step by Step Guide explains how to hold a drawing with the Third-Party Draw Service Step by Step Video shows how to hold a drawing with the Third-Party Draw Service Price Calculator tells exactly how much your drawing will cost Drawing FAQ answers common questions about holding drawings Public Records shows all completed drawings going back five years Drawing Result Widget can be used to publish your winners on your web page Multi-Round Giveaway Service for verified video giveaways

Integer Generator makes random numbers in configurable intervals Sequence Generator will randomize an integer sequence of your choice Integer Set Generator makes sets of non-repeating integers Gaussian Generator makes random numbers to fit a normal distribution Decimal Fraction Generator makes numbers in the [0,1] range with configurable decimal places Raw Random Bytes are useful for many cryptographic purposes

List Randomizer will randomize a list of anything you have (names, phone numbers, etc.) String Generator makes random alphanumeric strings Password Generator makes secure passwords for your Wi-Fi or that extra Gmail account Clock Time Generator will pick random times of the day Calendar Date Generator will pick random days across nearly three and a half millennia Geographic Coordinate Generator will pick a random spot on our planet's surface Bitmaps in black and white Hexadecimal Color Code Generator will pick color codes, for example for use as web colors Pregenerated Files contain large amounts of downloadable random bits Pure White Audio Noise for composition or just to test your audio equipment Jazz Scales to practice improvisation for students of jazz guitar Samuel Beckett's randomly generated short prose DNA Protein Sequence Randomizer (at Bio-Web)

Integer Widget Wizard will put a mini-RANDOM.ORG on your web page or blog Draw Widget Wizard will put the result of a paid drawing on your web page or blog HTTP API to get true random numbers into your own code Guidelines describe how to avoid getting in trouble Banned Hosts lists who didn't behave and have been blocked

Introduction to Randomness explains what true random numbers are and why they're interesting History explains how RANDOM.ORG started and where it is today Many Testimonials from folks who have found very creative uses for random numbers Acknowledgements to all the generous folks who have helped out Quotations about randomness in science, the arts and in life generally Media Coverage and Scientific Citations lists popular print and scientific mention of the service News about the latest additions to the site

Real-Time Statistics show how the generator is performing right now Statistical Analysis explains how you test random numbers for randomness Bit Tally shows how much randomness has been generated since 1998 (hint: lots!) Your Quota tells how many random bits you have left for today

This form allows you to generate random integers. The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random number algorithms typically used in computer programs.

Note: The numbers generated with this form will be picked independently of each other (like rolls of a die) and may therefore contain duplicates. There is also the Sequence Generator, which generates randomized sequences (like raffle tickets drawn from a hat) and where each number can only occur once.

A pseudo-random number generator (PRNG) is typically programmed using a randomizing math function to select a "random" number within a set range. These random number generators are pseudo-random because the computer program or algorithm may have unintended selection bias. In other words, randomness from a computer program is not necessarily an organic, truly random event.

A true random number generator (TRNG) relies on randomness from a physical event that is external to the computer and its operating system. Examples of such events are blips in atmospheric noise, or points at which a radioactive material decays. A true random number generator receives information from these types of unpredictable events to produce a truly random number.

Various applications of randomness have led to the development of several different methods for generating random data. Some of these have existed since ancient times, among whose ranks are well-known "classic" examples, including the rolling of dice, coin flipping, the shuffling of playing cards, the use of yarrow stalks (for divination) in the I Ching, as well as countless other techniques. Because of the mechanical nature of these techniques, generating large quantities of sufficiently random numbers (important in statistics) required much work and time. Thus, results would sometimes be collected and distributed as random number tables.

Several computational methods for pseudorandom number generation exist. All fall short of the goal of true randomness, although they may meet, with varying success, some of the statistical tests for randomness intended to measure how unpredictable their results are (that is, to what degree their patterns are discernible). This generally makes them unusable for applications such as cryptography. However, carefully designed cryptographically secure pseudorandom number generators (CSPRNGS) also exist, with special features specifically designed for use in cryptography.

Random number generators have applications in gambling, statistical sampling, computer simulation, cryptography, completely randomized design, and other areas where producing an unpredictable result is desirable. Generally, in applications having unpredictability as the paramount feature, such as in security applications, hardware generators are generally preferred over pseudorandom algorithms, where feasible.

The generation of pseudorandom numbers is an important and common task in computer programming. While cryptography and certain numerical algorithms require a very high degree of apparent randomness, many other operations only need a modest amount of unpredictability. Some simple examples might be presenting a user with a "random quote of the day", or determining which way a computer-controlled adversary might move in a computer game. Weaker forms of randomness are used in hash algorithms and in creating amortized searching and sorting algorithms.

Some applications which appear at first sight to be suitable for randomization are in fact not quite so simple. For instance, a system that "randomly" selects music tracks for a background music system must only appear random, and may even have ways to control the selection of music: a true random system would have no restriction on the same item appearing two or three times in succession.

There are two principal methods used to generate random numbers. The first method measures some physical phenomenon that is expected to be random and then compensates for possible biases in the measurement process. Example sources include measuring atmospheric noise, thermal noise, and other external electromagnetic and quantum phenomena. For example, cosmic background radiation or radioactive decay as measured over short timescales represent sources of natural entropy.

The second method uses computational algorithms that can produce long sequences of apparently random results, which are in fact completely determined by a shorter initial value, known as a seed value or key. As a result, the entire seemingly random sequence can be reproduced if the seed value is known. This type of random number generator is often called a pseudorandom number generator. This type of generator typically does not rely on sources of naturally occurring entropy, though it may be periodically seeded by natural sources. This generator type is non-blocking, so they are not rate-limited by an external event, making large bulk reads a possibility.

Some systems take a hybrid approach, providing randomness harvested from natural sources when available, and falling back to periodically re-seeded software-based cryptographically secure pseudorandom number generators (CSPRNGs). The fallback occurs when the desired read rate of randomness exceeds the ability of the natural harvesting approach to keep up with the demand. This approach avoids the rate-limited blocking behavior of random number generators based on slower and purely environmental methods.

While a pseudorandom number generator based solely on deterministic logic can never be regarded as a "true" random number source in the purest sense of the word, in practice they are generally sufficient even for demanding security-critical applications. Carefully designed and implemented pseudorandom number generators can be certified for security-critical cryptographic purposes, as is the case with the yarrow algorithm and fortuna. The former is the basis of the /dev/random source of entropy on FreeBSD, AIX, OS X, NetBSD, and others. OpenBSD uses a pseudorandom number algorithm known as arc4random.[2] 350c69d7ab