• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Computer Randomness?

ReFLeX

Graduate Poster
Joined
Feb 4, 2005
Messages
1,141
I was attempting to explain Monte Carlo simulations to a guy who was telling me that "80% of all statistics are false" is not a joke. This because I said "statistically significant", to which he replied 'statistics is all wrong, anyway'...
However. He denied that computers are capable of randomness, on the basis that they are systematic and can only perform sequences of operations. Thereby if a computer was to generate an extremely large list of three digit numbers, there would be a discoverable sequence.
Now, I'm fairly confident that computers are more capable of randomness than humans. But are they perfectly random? How is this accomplished, on a basic level? Perhaps not on a basic level at all, I'm thinking.
 
The algorithms that your computer uses are called pseudo-random number generators. That's because they use a deterministic algorithm - if you know the previous number generated, you can figure out what the next number was. That's anything but random. What they do is give the appearance of randomness, while fairly uniformly distributing the values over the number space.

There ARE hardware devices that can be attached that produce true randomness, if necessary. Other schemes use techniques like reseeding the deterministic algorithm with some fairly random number, such as the low order bits of the time when the user presses a key. I'll let others quibble about the extent to which schemes like that might be called "random".
 
there would be a discoverable sequence.

Define "discoverable". I think you could spend a long time trying to discover the sequence in a list of pseudo-random numbers from a computer.

Other schemes use techniques like reseeding the deterministic algorithm with some fairly random number, such as the low order bits of the time when the user presses a key.

My idea was to use the electrical noise on the soundcard's line in to generate random numbers. It seemed to work fairly well, in as much as there was a 50/50 distribution of parities on the sound samples, which is as far as I investigated.

David
 
There are many schemes for creating random numbers on a computer that don't depend on computing, for instance taking input from a geiger counter. But even the "A pattern would emerge" is not a correct description of sequences which can be computed, such as the decimal expansion of Pi.


Edited to add: I'm extremely skeptical of the utility of trying to talk sense into people who argue that the findings of basic mathematics are wrong wrong wrong.

I once knew somebody who wanted to buy a house while she was sky high in credit card debt and getting higher and higher. The credit union referred her to an advisor who specialized in planning how to get out of debt. She reported to me that she'd been sent to an "evil lady", because she refused to accept the realities of compound interest--and that a credit line is not an infinite line of cash. Shortly thereafter, she got a bad credit rating. Years later, she reportedly got psychiatric help. But at the time, no amount of facts, arithmetics, or beating her head against reality would get through to her.
 
I try to stay optimistic by thinking that hopefully I can persuade at least one person to start looking things up, to get themselves educated. That is, after all, what the JREF is all about. It's not about throwing up your hands and saying, "No, you're wrong."
 
As Roger said, computer algorithms are deterministic. However, that does not mean that, as your friend said, "if a computer was to generate an extremely large list of three digit numbers, there would be a discoverable sequence.".

Extremely good pseudo-random number generators exist. So good that even the most sensitive tests we know of cannot distinguish between the output of these algorithms and a truly random process.

As to what any of this has to do with the claim that "statistics is all wrong anyway", I cannot even imagine. My suspicion is that he simply does not have any idea what he is talking about.


Dr. Stupid
 
I think people misunderstand the problem with statistics--it's not so much that the information is invalid, as that it's so often misinterpreted, unintentionally or deliberately.
 
33.3% of all people surveyed agree that 27.6% of all statistical results are made up.
 
Without a source of noise provided by hardware, a random number generator will be deterministic. There are different algorithms for producing random numbers, and they have different "strengths", cryptographically speaking.

A secure random number generator (eg: as provided by the SecureRandom java class) has the following property: even if you know exactly how the generator works, you cannot deduce from it's output alone what state the generator is in.

In order to work at all, a random number generator must be given an initial source of entropy, or "seed". Without that, it will always produce the same sequence of numbers. A weak way to do this is to seed it with the current time in milliseconds. It is week because if you know roughly what time the generator was seeded, you can try seeding an identical generator untill you get a match.

The java "SecureRandom" seeds itself by starting up a number of threads and timing them. The time taken by the threads relies on the details of what the machine is doing, and is pretty safe. For a project I worked on I found that this initialisation was takinf too long (several seconds), so I used the current time, the current free memory, and the current contents of the system "temp" directory as a source of entropy. Good enough, I hope.

You might use thousands of 32-bit numbers generated psudeorandomly. All will depend deterministically on the initial (say) 128 bits - so there are far far fewer possible sequences than if the generator was truly random. But that far far smaller number is 2^128, which is pretty safe.

Generally speaking, 128 bits of entropy is is enough for any purpose, owing to the thermodynamic minimum amount of energy that a computing device would have to dissipate to attack it by brute force.
 
The random number generators in slot machines are checked out by an independent testing laboratory for "pure" randomness, in that they pass our conventional tests for randomness. If you flip a coin 100 times, it's possible to get 100 heads, and it would be just as random as getting 50 heads. Random number generators are typically geared towards coming up with statistically correct number sequences. The entropy of the system is maintained because the timing of the player pressing the "spin" button is a determining factor in the outcome. Needless to say, the player has no idea what state the processor is in.
 
roger said:
That's because they use a deterministic algorithm - if you know the previous number generated, you can figure out what the next number was

Small nitpick: if you know enough previous numbers, you can compute the next.

There are algorithms for pseudo-random number generation where the next number depends on more than one previous number.
 
Stimpson J. Cat said:
As to what any of this has to do with the claim that "statistics is all wrong anyway", I cannot even imagine. My suspicion is that he simply does not have any idea what he is talking about.


Dr. Stupid
...Monte Carlo simulations, right. The powerful computer alternative to manual hypothesis testing in statistics: http://en.wikipedia.org/wiki/Monte_Carlo_simulation

Interesting history in there that I didn't know about:
Perhaps the most famous early use was by Fermi in 1930, when he used a random method to calculate the properties of the newly-discovered neutron. Monte Carlo methods were central to the simulations required for the Manhattan Project, though were strongly limited by the computational tools at the time. However, it was only after electronic computers were first built (from 1945 on) that Monte Carlo methods began to be studied in depth. In the 1950s they were used at Los Alamos for early work relating to the development of the hydrogen bomb, and became popularized in the fields of physics and operations research. The Rand Corporation and the U.S. Air Force were two of the major organizations responsible for funding and disseminating information on Monte Carlo methods during this time, and they began to find a wide application in many different fields.

Uses of Monte Carlo methods require large amounts of random numbers, and it was their use that spurred the development of pseudorandom number generators, which were far quicker to use than the tables of random numbers which had been previously used for statistical sampling.
 
gnome said:
I think people misunderstand the problem with statistics--it's not so much that the information is invalid, as that it's so often misinterpreted, unintentionally or deliberately.
This is exactly the point I needed to get across: that statistically significant results doesn't mean the results are wrong (wouldn't that be funny to suddenly learn) and that it isn't the fault of statistics when humans decide to exploit them.
 
One smart thing about a PRNG is that you can have a sequence repeated. This is very useful while building and debugging programs that use random numbers, because you can make the program react predictably by using the same seed on each run.

Hans
 
MRC_Hans said:
One smart thing about a PRNG is that you can have a sequence repeated. This is very useful while building and debugging programs that use random numbers, because you can make the program react predictably by using the same seed on each run.

Hans
Yeah, I'm always doing that... debugging those random number programs ... *shakes head*
 
For a project I worked on, one of the applications required a random binary number to be input as the seed to the encryption (or something like that!).

Anyway, it provided a random number generator in which you moved the mouse 'at random' to generate said number, or you could pick your own number.

However, one of the chief techie guys didn't trust the generator as it wasn't random enough for his liking. So he got a coin and flipped it 128 times and recorded heads as 1, and tails as 0.

The real daft bit came at the end when he looked at the number and decided it still wasn't random enough, and swapped a bunch of the digits around :confused:

Quite how he decided the first set of numbers wasn't random is beyond me!

Dave
 
In the OP, ReFlex uses the expression "Perfectly random".

I wonder - does that term have a rigorously defined meaning?

There seems an inherent contradiction here. If a number is perfectly random, then no number can be "more" random. So the number should be, in principle, calculable in advance- hence not random at all. Only imperfectly random numbers would be wholly unpredictable.

"Random numbers", like "infinite numbers", leave me feeling that I was off school the day they were explained.
 
DrDave said:
...The real daft bit came at the end when he looked at the number and decided it still wasn't random enough, and swapped a bunch of the digits around...
My psychology text has a special section on the non-intuitiveness of true random sequences. Supposing there is two possible outcomes, then a person is more likely to identify as random a sequence that alternates often than one with pairs and trios of the same outcome in a row.
A-B-A-B-B-A-B-A-B
B-A-A-B-A-B-B-A-A
Though the upper sequence is less likely to occur in an equal probability scenario, that is how people envision randomness, oddly. The same thing applies to lotteries in which you pick four numbers. Something like 40% of all possible numbers contain the same digit twice, yet almost everyone picks a number that has four unique digits, because it seems more probable. But, as we know, each sequence is just as likely to win as "9-9-9-9". In a perfectly random scenario, that is. Which brings me to:

Originally posted by Soapy Sam
In the OP, ReFlex uses the expression "Perfectly random".

I wonder - does that term have a rigorously defined meaning?
Yes. Each possible outcome is exactly equally likely to occur.
There seems an inherent contradiction here. If a number is perfectly random, then no number can be "more" random.
The number is not random on its own. It is how the number is selected that produces randomness.
So the number should be, in principle, calculable in advance- hence not random at all. Only imperfectly random numbers would be wholly unpredictable.
Err, no. You're overthinking this. Random just means every outcome is just as probable as another. If a random number generator gives me "666" as a random number, there is nothing special about that number. What's perfectly random about it is how the number was chosen.
"Random numbers", like "infinite numbers", leave me feeling that I was off school the day they were explained.
Understand infinity... if only...
 

Back
Top Bottom