Computers are Lousy Random Number Generators

Foxyshadis, I assume you are referring to Heisenbergs principle of uncertainty? This is but a principle, not a lemma nor a proved certaincy. One should be careful about ruling out future possebilities, it was once thought as well, that heavier than air machines could not fly. As Arthur C. Clarke puts it “Any sufficiently advanced technology is indistinguishable from magic”.

The Mersenne Twister is not random enough. With enough output data, all future outputs (before changing seeds) can be predicted. It’s good enough for most people, which is wildly different.

Hi,

another funny thing about computer generated randomness: There’s a community on the web that uses emulators and their tools combined with save states to try and create perfect movies of how to play old videogames.

Because all randomness happening is seeded in the same way, exact key combinations will always result in exactly the same things happening in the game.

That way, creating a movie is just about storing which keys are pressed in which frame and playing back these combinations.

The emulation always starts at a defined state and the whole randomness in the game is reduced to the machines real time clock and the users input, thus making the movies work.

The end result is a real piece of art and much more interesting from an entertainment point of view than it is from a scientific one.

Besides the fact that movies like this one: http://tasvideos.org/715M.html are a way
to visually display bugs in program code :slight_smile:

Philip

Randomness is wonderful stuff and very hard either to define or produce. Only physical random number sources are really random, but they can have serious problems - mostly by having some easily detected statistical trends. For much more fun (though seriously more mathematical) try Greg Chaitin’s work
(his website is http://www.umcs.maine.edu/~chaitin/ – don’t let the rather poor web design or the clear self aggrandizement put you off).

Excellent points. The investigation of randomness is a fascinating, almost philosophical concept.

Even environmental sources of randomness need to be “whitened” before they’re random enough. And the many statistical tests you can perform (ent.exe is one example, linked in the first few comments above) can’t definitively, absolutely tell you if a given set of data is totally random.

When something is random it really just means that it’s too complex or we lack the proper tools to develop an algorithm for it doesn’t it? You can reproduce complex dice rolling outcomes with good equipment in an isolated environment. Noise isn’t really random; afterall, electrons don’t make choices about where they go next.

The best way to generate output which simulates real-world phenomena is to map the output from a random number generator to the normal distribution. This will give you a random values which will lie mostly about a mean, governed by the normal curve.

As for randomness in general, i think the world is actually random at resolutions where heisenbergs uncertainty principle comes into play. At other resolutions (e.g. marco) then you can predict most things to a reasonable probability. Casper, Heisenbergs is an inherent property - a principle. It doesn’t need proving because its not a theorem or law, its simply is. It falls out of wave-particle duality; be my guest and prove some of that stuff wrong :confused:

Isn’t the mersenne twister random enough? I can’t predict the next value without your seed, even if i know the algorithm.

Actually, the best randomness-generator I’ve seen in a while are some of the posts to this blog entry…

Lol, thats almost on the money. Just last week i half-built a program which gives a word (sequentially running through any text file - a dictionary for instance) to google and parses the resultant html to find the first letter in the url of each page returned. Thats random.

Casper, I meant more along the lines of, there is not enough computer memory to store the starting positions of every particle in the earth, or the processing power to do anything with it, nor would it be possible to measure the current states of every particle on earth at once. But it’d certainly give you a very accurate forecast if you could. :stuck_out_tongue: Thus it’s all theory. Nothing to do with herr heisenburg.

Wow, so many of the comments (as well as the original article) are so far off the mark it’s crazy. I do want to correct one mistake made, when programs take user keystrokes or mouse movements they’re not looking at all of the data, only the smallest increments. So if you tried to move your mouse from 0x0 to 100x100 you would sometimes hit 1x0 or 99x100. The only bit used in the ‘random’ process is the last bit, which is mostly random. Also the ‘environmental’ measurements are also used the same way. The CPU fan speed or system temperature might be easy to guess, but not the least significant digits.

Only a computer with no inputs is really incapable of creating random numbers. Computers with inputs (like the keyboard, the mouse, the CPU thermometers, etc) are cable of getting random numbers from those inputs.

Some day I’d like to build a lava can – it’ based on the luminance values of a webcam in the dark.

http://www.lavarnd.org/lavarnd.html

It’s claimed to be a good source of randomness.

Here’s a recipe: Monitor the webcamand mic. Ask the user to imitate a six year old singing “Happy Birthday”

No one I know ever sings Happy Birthday in the same key so it’d be pretty random :slight_smile:

Just as juha said, there is no ‘true’ randomness. Even the roll of a die can be a funtion of its bobble in ones hand, momentum and spin of its fall and impact on the surface. Life itself is a very large, complicated equation. So by making a computer generate a large complicated equation, we have emulated life’s randomness.

But how can something truly be random? How can something happen, and not have any reason? Everything happens for a reason.

True randomness is impossible for a computer to emulate. If we can’t even pick 10 different random numbers then how can computers do it??

Very interesting comments. I have to attack the notion that there is no random, as that’s probably nonsense. People are getting somewhere saying most random stuff might be predictable if we could measure more. However, there are devices like those made by MagiQ that use Quantum Physics to generate perfectly random numbers: quantum physics says there is ALWAYS a 50/50 chance of it being a 0 or a 1. Want a definition of random? See: MagiQ’s output.

I liked Tyson’s post, as his technique is similar to mine: use search results for rand numbers. His is simple, but I wanted more. From a large dictionary, I choose random number of random words. I randomly choose a search engine from large list (found on allsearchengines.com). Then, randomly pick a result; parse random section of it. I create a number out of that, rarely getting the same one consecutively. Usually I use as seeds (combined with a time function) for a typical RNG. Since it doesn’t need to be crytpo-secure for my uses, I do most of this with the fastest RNG i get my hands on. (sometimes different RNG’s for different components) What yall think? Good way to make seeds?

Note, the whole point of this was because all the RNG’s gave the same numbers in a row if I executed the program several times real quick. I assume it has something to do with how the system time works, since it was the seed. Now, I still use time, but merge it with one of these seeds. An algorithm uses about 20-50 of these seed addons, hopefully dealing with this darn problem. ($20 says someone has easy solution that I overlooked, which doesn’t require all this effort. Of course, I did this more for challenge than anything)

As for the audio and video ideas, the only concern I have with these is the limit on the collected data. Someone mentioned that most audio might end up in certain frequencies. Even with happy birthday, there would be many similarities, and the differences not so great. Could these patterns and limitations screw up the randomness?

To Zed: Yeah, I heard about using a lava lamp and thought it was original and cool. Whether it’s effective is debatable… Tks for providing a link so I can look into it. :wink:

To webmaster: This captcha doesn’t seem so secure. It’s the same word done the same way since earlier today. Plus, it’s written in a solid font on a solid background, with no variation except shape. Most handwriting looks worse, and yet is recognized. Might want to change to a better one. You can start by looking at what has been broken, some of which is here and here:

http://www.cs.sfu.ca/~mori/research/gimpy/
http://sam.zoy.org/pwntcha/

Merry Christmas all!

I’m retired now but when I was in college I wrote a paper and presented to an IEEE audience on something like what you are doing. Back then, late 1970’s, there were only 8-bit processors and random algorithms where floating point oriented. Intel microprocessors back then had no floating point instructions. So, I experimented with developing an algorithm using algorithm composed of efficient assembly instructions; mostly using as shift and mask operations which looping through the key. I did the same thing you are doing plotting the dots on screen, using x, y random pairs. For weeks I searched for the “best” candidate algorithm. Note by random number I mean it was pseudo-random, reproducible, as opposed to using some hardware clock register which is random but not reproducible. Once the algorithm was completed I then tested using techniques described in “The Art of Computer Programming Volume 2”, by Knuth. I decided on 5 different tests referencing the material in the book.

The final test was to run the algorithm and search for when the random sequence begins to reproduce the sequence. This is very important because that is what causes dots to take on pattern that seem to be describing. In conclusion I have found in my research that the best pseudo-random generators can be developed to behave random, but then the CPU time can then be a concern. The result is a trade-off.

So, my technique can be best summarized by making the algorithm a state machine, where the random data from the previous operation is plugged back in, then again with each iteration, and group of operations.

For example a seed value initially used to produce the first number using the random generator. The seed value changes with each random number. The random number is then used to index in to a deck of cards, and after getting the card the card is placed back in the deck randomly. When it’s time shuffle the deck of cards are in a random sequence to be reused again. The next sequence uses the previous random deck sequence as random cards are selected, and the deck is further randomized. The same approach could be applied to other types of random sequences. what_another_bob@yahoo.com, attn: pseudo-random

From a .Net prospective, System.Random number generation are not random, they are psuedo-random. The numbers are generated from a set size of 10 to the 24th (I could be wrong on the set size). So, if you can find out where in the set of numbers you are at, you can guess correctly the next number.

For practical purposes, this is random enough and the numbers generated will converge to statistical probabilities as the iterations progress. However, since this “randomness” can be predicted, it can be exploited. So, typically, more secure methods are used to generate random numbers that are harder to crack. I imagine that card games and places like Las Vegas don’t don’t use System.Random in any of thier slot machines…

Jon Raynor

Pi
I usually take a chunk out of pi to make a seemingly random number.

1 Like