How to be random

We use cookies to remember your preferences and to analyze our traffic. We do not carry ads and will never sell your data to third parties.

Necessary Preferences Statistics

Please see our Cookie Policy or visit our Privacy Dashboard for more information.

Allow Selected Allow All

What’s this fuss about true randomness?

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.

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.

Games and Lotteries

Lottery Quick Pick is perhaps the Internet’s most popular with over 280 lotteries
Keno Quick Pick for the popular game played in many countries
Coin Flipper will give you heads or tails in many currencies
Dice Roller does exactly what it says on the tin
Playing Card Shuffler will draw cards from multiple shuffled decks
Birdie Fund Generator will create birdie holes for golf courses

Random Drawings

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

Numbers

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

Lists and Strings and Maps, Oh My!

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)

Web Tools and Widgets for Your Pages

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

How to be random

Learn about Randomness

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

How to be random

Statistics

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

Contact and Help

FAQ contains answers to frequently asked questions
Newsletter appears at random intervals, but do sign up
Contact Details in case you want to get in touch

“You are Sooo Random!” – Randomness & Creativity Research

Posted April 8, 2010

One of the advantages of being disorderly is that one is constantly making exciting discoveries.
(A.A. Milne)

If you were a rabbit, fleeing from a fox, would you be more successful if following a predictable path, or a path that zigzags, unpredictably and randomly? If you are an average kind of rabbit, who does not want to be eaten and who wants to pass on his/her genes, it would serve you well to escape in a zigzag manner, completely randomly. The fox will then become confused and give up, while you make it home in time for a firefly-lit dinner of fresh carrots and cabbage. That’s the animal world. In the human world (granted also animal, but with a larger frontal lobes), randomness has been suggested to evolve into what is now known as human creativity. If something is random, it is by definition variable, different, unlike a stereotypical thought (response, product, etc).

But does creativity really benefit from randomness? Just think of children or individuals with psychopathology – their answers can be random and thus very different, but can these answers be called creative? In the research world, it is agreed that creativity requires novel AND appropriate responses. Thus it seems a combination of randomness and lack of it (focus?) might be necessary. We set out to explore such musings in our recent study. In the laboratory, participants were asked to generate numbers on a computer keyboard (Random Number Generation task). Then their creative potential was assessed, as well as their actual creative achievement history. It turned out that both random and non-random processes were involved. Specifically, being random was predictive of creative fluency, which is simply generating as many responses to a given task as possible. Randomness was also related to creative flexibility, or the ability to switch between categories. However, being LESS random was predictive of creative originality, or the number of responses that are unique, as well as of actual creative achievement.

These findings provide support for the idea that creativity does not only involve looser association, defocused or focused attention, lack of fixedness, etc. (suggested in literature), but most likely it is about being flexible, and knowing (either consciously and/or subconsciously) what is functional and when. We reached a similar conclusion in another study of ours, where we found that creative folks displayed more flexible cognitive control. Oshin Vartainian also reported that creative people were better at adjusting their focus of attention as a function of task demands. Based on the provided support, it is apparent then that it’s advantageous to be as random as possible for generation of ideas, but sticking with a particular response is predictive of creative originality.

So next time your friends say that you are “sooo random,” hold your head up high and keep at it. But don’t forget to spot those brilliant ideas among the dis-order, and focus. Such is the recipe for creativity.

References

Miller, G. F. (2000). The mating mind. New York: Random House.

Vartanian, O. (2009). Variable attention facilitates creative problem solving.Psychology of Aesthetics, Creativity, and the Arts, 3, 57-59.

Zabelina, D. L. (2010). Creativity and randomness (Unpublished master’s thesis). North Dakota State University, Fargo, ND.

Zabelina, D. L., & Robinson, M. D. (in press). Creativity as flexible cognitive control. Psychology of Aesthetics, Creativity, and the Arts.

How to be random

Alexander Arobelidze

How to be random

People have been using random numbers for millennia, so the concept isn’t new. From the lottery in ancient Babylon, to roulette tables in Monte Carlo, to dice games in Vegas, the goal is to leave the end result up to random chance.

But gambling aside, randomness has many uses in science, statistics, cryptography and more. Yet using dice, coins, or similar media as a random device has its limitations.

Because of the mechanical nature of these techniques, generating large quantities of random numbers requires great deal of time and work. Thanks to human ingenuity, we have more powerful tools and methods at our disposal.

Methods for generating random numbers

True Random Numbers

How to be random

Picture of analog-input digital-output processing device. Photo by Harrison Broadbent

Let’s consider two principal methods used to generate random numbers. The first method is based on a physical process, and harvests the source of randomness from some physical phenomenon that is expected to be random.

Such a phenomenon takes place outside of the computer. It is measured and adjusted for possible biases due to the measurement process. Examples include radioactive decay, the photoelectric effect, cosmic background radiation, atmospheric noise (which we will use in this article), and more.

Thus, random numbers generated based on such randomness are said to be “true” random numbers.

Technically, the hardware part consists of a device that converts energy from one form to another (for example, radiation to an electrical signal), an amplifier, and an analog-to-digital converter to turn the output into a digital number.

What are Pseudorandom Numbers?

How to be random

Picture of computer code flowing through computer screen. Photo by Markus Spiske.

As an alternative to “true” random numbers, the second method of generating random numbers involves computational algorithms that can produce apparently random results.

Why apparently random? Because the end results obtained are in fact completely determined by an initial value also known as the seed value or key. Therefore, if you knew the key value and how the algorithm works, you could reproduce these seemingly random results.

Random number generators of this type are frequently called Pseudorandom number generators and, as a result, output Pseudorandom Numbers.

Even though this type of generator typically doesn’t gather any data from sources of naturally occurring randomness, such gathering of keys can be made possible when needed.

Let’s compare some aspects of true random number generators or TRNGs and pseudorandom number generators or PRNGs.

PRNGs are faster than TRNGs. Because of their deterministic nature, they are useful when you need to replay a sequence of random events. This helps a great deal in code testing, for example.

On the other hand, TRNGs are not periodic and work better in security sensitive roles such as encryption.

A period is the number of iterations a PRNG goes through before it starts repeating itself. Thus, all other things being equal, a PRNG with a longer period would take more computer resources to predict and crack.

Example Algorithm for Pseudo-Random Number Generator

A computer executes code that is based on a set of rules to be followed. For PRNGs in general, those rules revolve around the following:

  1. Accept some initial input number, that is a seed or key.
  2. Apply that seed in a sequence of mathematical operations to generate the result. That result is the random number.
  3. Use that resulting random number as the seed for the next iteration.
  4. Repeat the process to emulate randomness.

Now let’s look at an example.

The Linear Congruential Generator

This generator produces a series of pseudorandom numbers. Given an initial seed X0 and integer parameters a as the multiplier, b as the increment, and m as the modulus, the generator is defined by the linear relation: Xn ≡ (aXn-1 + b)mod m. Or using more programming friendly syntax: Xn = (a * Xn-1 + b) % m.

Each of these members have to satisfy the following conditions:

  • m > 0 (the modulus is positive),
  • 0 < a < m (the multiplier is positive but less than the modulus),
  • 0b < m (the increment is non negative but less than the modulus), and
  • 0X0 < m (the seed is non negative but less than the modulus).

Let’s create a JavaScript function that takes the initial values as arguments and returns an array of random numbers of a given length:

The Linear Congruential Generator is one of the oldest and best-known PRNG algorithms.

As for random number generator algorithms that are executable by computers, they date back as early as the 1940s and 50s (the Middle-square method and Lehmer generator, for example) and continue to be written today (Xoroshiro128+, Squares RNG, and more).

A Sample Random Number Generator

When I decided to write this article about embedding a random number generator within a web page, I had a choice to make.

I could’ve used JavaScript’s Math.random() function as the base and generate output in pseudorandom numbers like I have in earlier articles (see Multiplication Chart – Code Your Own Times Table).

But this article itself is about generating random numbers. So I decided to learn how to gather “true” randomness based data and share my discovery with you.

So below is the “true” Random Number Generator. Set the parameters and hit Generate.

R ANDOMNESS IS A valuable commodity. Computer models of complex systems ranging from the weather to the stockmarket are voracious consumers of random numbers. Cryptography, too, relies heavily on random numbers for the generation of unbreakable keys. Better, cheaper ways of generating and handling such numbers are therefore always welcome. And doing just that is the goal of a project with the slightly tongue-in-cheek name of COINFLIPS, which allegedly stands for Co-designed Improved Neural Foundations Leveraging Inherent Physics Stochasticity.

Your browser does not support the

Enjoy more audio and podcasts on iOS or Android.

COINFLIPS operates under the aegis of Brad Aimone, a theoretical neuroscientist at Sandia National Laboratories (originally one of America’s nuclear-weapons laboratories, but which has now branched out into other areas, too). Dr Aimone’s starting-point is the observation that, unlike the circuits of digital computers, which will, if fed a given input, respond with a precise and predictable output, the link between input to and output from a nerve cell is more haphazard—or, in the jargon, “stochastic”. He wants to imitate this stochastic behaviour in something less squishy than a nerve cell. By doing so, he thinks he might be able to tune the distribution of digits that a random-number generator spits out, without affecting their underlying randomness.

Random doodlings

That would be useful. Existing random-number generators produce uniform distributions. (A “3”, say, is exactly as likely to appear as a “7”.) But, as Dr Aimone’s colleague Darby Smith notes, the real world that computer modellers are trying to model does not work like this. For example, the temperature in London in December may vary between -7°C and 17°C, but is most likely to be in the range 3°C to 8°C. Similarly, vessels are more likely to be in trouble close to a busy shipping route than in a remote backwater. Distorting uniform distributions of random numbers to take account of these realities is tedious and unsatisfactory. As Dr Smith observes, it would be more efficient if the random numbers used corresponded to the natural distribution in the first place.

There is also an abundance problem. Finding random phenomena in nature that can be transformed into computer bits is not easy. Often the source is computing itself—for example, by gathering the last digits in the numbers of milliseconds between keystrokes made by zillions of users. Otherwise, specialist, expensive hardware needs to be used to do things such as measuring heat flux through a silicon chip.

To eke out these scarce supplies, such truly random numbers are often then employed to seed programs called pseudo-random-number generators. The algorithms behind those generate sequences of numbers that have the statistical properties of randomness. But this is not the same as the real thing. As John von Neumann, one of computing’s pioneers, observed: “Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin.” Moreover, if the purpose is cryptography, this method is particularly risky. The opposition might be able to work out the algorithm involved.

Another member of the project, Shashank Misra, says COINFLIPS’ researchers have identified two hardware-based approaches for the production of tuneable, abundant random numbers. One relies on the patterns magnetic films make when disturbed, the other on how electrons travel through the barrier of a quantum-tunnelling diode. Both of these things are truly random. And both can be tuned to provide the sort of random-number distributions COINFLIPS requires.

In a quantum-tunnelling diode, electrons randomly leap (or fail to leap) across a gap, and the distribution of success or failure can be changed (and therefore tuned) by altering the voltage. A magnetic film, meanwhile, is composed of many tiny magnets jostling with each other. Flip the polarity of one of these and others around it flip in response, creating a random pattern. In this case the plan is to build tuneability into the magnetic medium itself, by tinkering with its composition, and also applying strain to it.

Random-number-generating hardware based on either of these approaches could be built directly into chips. Alternatively, a random-number-generating unit might be added to existing devices to yield an endless supply of high-speed randomness in the way that graphics-processing units are added to machines that have to handle a lot of graphical material. Crucially, unlike the heat-flux method, which requires intermediate hardware involving thousands of transistors to translate the signal into digital bits, the results of the diode and film methods can be read off as bits directly, using only one or two transistors to do so.

The efficiency offered by COINFLIPS means some tasks which currently require a supercomputer might be carried out with desktop hardware, depending on how much of the load involves generating and manipulating random numbers. Dr Aimone says the current approach tends to be simply to build bigger computers where needed. But even then some large-scale tasks may be too costly in money and time lost to conduct. You can, for example, run a model of a hurricane’s path only so many times before the real thing makes landfall.

The heart of the matter

Despite its peregrinations elsewhere, though, Sandia is ultimately in the nuclear business, and one early application of whatever COINFLIPS comes up with is likely to involve interpreting the results of collisions in particle accelerators—something the team have been exploring in collaboration with Temple University, in Philadelphia. The idea is to build a device which incorporates COINFLIPS hardware into the sensor itself. This will allow results from collisions, which will be randomly distributed, but in particular ways, to be compared with artificial random distributions, to see if they match. To be able to do this in real time is useful, because it allows an immediate decision to be made about whether or not to store a particular result. Modern colliders generate so many collisions that such immediacy in decision-making is important.

That is one, rather specific, application. But in the longer run, says Dr Aimone, COINFLIPS should enable many types of calculation that are currently impossible because of the volume of random numbers needed—for example, artificial-intelligence systems that capture the uncertainty of the world. This might be done in the form of neural networks which, like the human brain, have randomness available at each synapse. And that, in turn, may lead to COINFLIPS, a project inspired by biology, returning the compliment by providing a better way of understanding of how brains themselves work. ■

To enjoy more of our mind-expanding science coverage, sign up to Simply Science, our weekly newsletter.

This article appeared in the Science & technology section of the print edition under the headline “Flipping heck!”