Can a computer generate random numbers?

m21s

Senior member
Dec 6, 2004
775
0
71
What the title says.

Can a computer actually generate random numbers?

Or will there always be some sort of pattern involved?
 

Bassyhead

Diamond Member
Nov 19, 2001
4,545
0
0
Random numbers generated by computer using software are pseudorandom. You can read all about it on Wikipedia. There's no way to get truly random numbers by using an algorithm, whether or not it's being run by a computer.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
there really isn't any such thing as 100% random in any case. IF you knew all the variables then any system should be predictible. Random so far as we are concerned just means that hte system is suitably complex that we cannot measure it accurately enough to always knwo the answer. So an algorithm is obviously a much simpler system than say the physics involved in roling a dice, so its easier to predict. Theoretically you could make a computer thats d@mn near random just by continuously seeding its algorithm with "true" random numbers, such as using the 4th signifigant digit in the external windspeed. Something that should pretty much bary wildly since the windspeed is d@mn hard to predict, especially down othe second and to the 4th signifigant digit. More or less this number will be completely random.(just hope you can meausure that well :p, and tha assumes that even when it seems that there is no apparent wind there is actually a tiny flow which could be detected, im no meterologist so I'm not sure jsut how little air movement no wind means, but you get the pooint....)
 

AeroEngy

Senior member
Mar 16, 2006
356
0
0
Yes, there are ways for computers to generate true random numbers. There are methods of sampling some kind of atmospheric random noise like RF static or something which is fed into a computer to create a random number. This process is truly random and will not result in a predictable pattern. Unlike the pseudo random numbers generated by algorithms in most computing.

Here is a link to some decent articles on the subject.
http://www.random.org/essay.html

 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
Pentium III and 4 processors have a true random number generator - based upon the random movement of electrons in a diode (Johnson noise).
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: Mark R
Pentium III and 4 processors have a true random number generator - based upon the random movement of electrons in a diode (Johnson noise).

I thought only Xeons had that? Or maybe it's just not exposed in the 'regular' ones?

Here's an article on how not to build an RNG for a public system: link to PlanetPoker story. (before anybody thinks about trying this today, all the online gaming sites that I am aware of use much better RNG systems; any programs you see purporting to do this on a site like PartyPoker are scams).
 

reaz

Junior Member
Feb 26, 2005
5
0
0
It's possible. There are several sampling methods which are used to generate random numbers. However, pseudo random numbers are useful for test.
 

harrkev

Senior member
May 10, 2004
659
0
71
Originally posted by: reaz
It's possible. There are several sampling methods which are used to generate random numbers. However, pseudo random numbers are useful for test.

Huh????

Current digital systems are completely deterministic. Same input in = same input out (assuming that everything is working OK -- setup and hold times are met). The ONLY way to get real random numbers into a computer is by having an external (non-digital) source. As mentioned above, Intel created a method where they use a diode to generate noise. The noise is amplified, and digitized. The running count of ones and zeros is used to bias the system so that the odds of getting either one is 50%. You could also get random data from a radio receiver tuned to static, a geiger counter, etc.

Of course, to make things NOT deterministic, you could also use a very good algorithm, and seed it with such things as how often you click on the mouse. Such things can be used to alter the seed. As long as the rate that you alter the seed is not too far off compared to the rate that the random is being used, this is not really random, but good enough for government work.
 

AnthraX101

Senior member
Oct 7, 2001
771
0
0
Hold up, a lot of misinformation getting thrown around here...

Assuming that your question is better phrased as "Can a deterministic state machine generate truly random numbers?", the answer is no. As John von Neumann famously stated, "Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin." Given any deterministic process (That is, any process that runs predictably.) it is a trivial nature to restart the process with the exact same initial internal state and receive the same result.

That isn't to say that there is absolutely no process which generates truly random numbers. If current quantum theories are correct, both radioactive decay and shot noise (as discussed earlier in the form of Johnson-Nyquist noise) are truly random physical processes that are impossible to predict, even given knowledge of the state of the entire universe. These effects can be measured by a deterministic system to provide it with a source of true unpredictable randomness.

Between these two absolutes there is quite a bit of a grey area. By measuring the actions of particular functions within the computer such as mouse and keyboard usage, disk access, processor usage, and many, many other values it is possible to produce output that is virtually impossible to recreate. When properly implemented (As in the *nix /dev/rand device) it can be strong enough to be considered secure for even the most sensitive of applications. The same can be said of things like taking static or barometric pressure readings, provided proper bleaching algorithms are used.

Hope that answers your question. Unfortunately, it isn't as simple as "yes" or "no", depending on how you meant to ask the question, but I think that this should give you whatever information you need.

AnthraX101
 

f95toli

Golden Member
Nov 21, 2002
1,547
0
0
It is also worth pointing out that for most PRACTICAL problems (like Monte Carlo-simulations) you do not need "real" random numbers. That are some very good pseudo-random number generators around and as long as you intitiate them with a good seed they produce very long series of numbers which are for any practical purpose random without any obvious pattern.

But as has already been stated: If you want a random number which is TRULY random (in the philosophical sense, meaning it is impossible even IN PRINCIPLE to predict the outcome) you need to measure the outcome of some sort of quantum mechanical stochastic process such as a tunnelling event, radioctive decay, tunnelling through a barrier, some sources of noise etc, there are lots of random processes in nature.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
Yeah, in the majority of cases pseudorandom numbers are actually alot better than real random numbers because you can repeate something over and over again while only having to remember the seed value. A simple example comes to mind in RTS games with random maps, where isntead of sending the 2-10meg map file it just sends the seed and all the computers generate the map on their own. That was increadibly important when people still had 56k since it would take 10minutes otherwise. Also, if you want to test how changes will effect something it better to use the EXACT same "random" numbers to test it. The only place where truely random numbers come in handy are if you don't want anyone to be able to replicate what you did.
 

OSX

Senior member
Feb 9, 2006
662
0
0
Of course software can only do PRNG, because it can't think and change the algorithm. Interestingly enough, the human brain, which is capable of thought, is crap at making random numbers.

First HT post, by the way. w00t.
 

gbuskirk

Member
Apr 1, 2002
127
0
0
I will argue that given any mathematical test for "randomness" in a sequence of numbers, there are many algorithmic functions that will generate a sequence that passes that test. And sub-sequences of a truly random stream, submitted to that test, will fail it. What then is randomness?
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: gbuskirk
I will argue that given any mathematical test for "randomness" in a sequence of numbers, there are many algorithmic functions that will generate a sequence that passes that test. And sub-sequences of a truly random stream, submitted to that test, will fail it. What then is randomness?

The definition you're probably looking for is along the lines of:

A sequence of numbers is 'random' if, no matter how many numbers in the sequence you are given, you are no more likely to be able to pick the next number correctly than if you have no information about the sequence.

Any PRNG that is not reseeded periodically with truly 'random' numbers (or at least 'random enough' numbers) will not pass this test. Eventually you would be able to deduce the algorithm, given enough numbers from the output stream. Or at least you would be able to narrow it to some set of possible algorithms, giving you a better-than-random chance to pick the next number. A truly 'random' set of numbers (from a hardware RNG measuring radioactive decay, etc.) would always pass this test.

However, in some sense, it is impossible to determine from sampling part of a number sequence whether that sequence is truly 'random' -- you might just not have sampled enough numbers (or the right numbers) from the sequence to pick up on the pattern. Conversely, you might have a partial sequence from a truly 'random' sequence that looks like it has a definite pattern! With a finite number of samples, you can only come up with some probability that the sequence is truly random or not. For a small enough range of possible values and a large enough set of samples, that probability can be very close to 1 or 0, but you can never really be sure.
 

sao123

Lifer
May 27, 2002
12,653
205
106
it seems to me that you should be able to use Heisenbergs uncertainty principal to generate random numbers logically....


however this requires more thought on my part.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
Well, it should be noted that nothing is really random. IF you were able to take into account every variable in the equations used then you could predict the outcomes. Its just that in natural phenomenon there are too many variables to actually predict the outcome. If you really knew everything involved then you could crack an algorithm even if it was based on something seemingly random like readioactive decay.
 

sao123

Lifer
May 27, 2002
12,653
205
106
Originally posted by: BrownTown
Well, it should be noted that nothing is really random. IF you were able to take into account every variable in the equations used then you could predict the outcomes. Its just that in natural phenomenon there are too many variables to actually predict the outcome. If you really knew everything involved then you could crack an algorithm even if it was based on something seemingly random like readioactive decay.



ahhh... so you can tell me the precise location and velocity vector of an electron?
I thinks NOT!!!
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: her209
variable = rand();

That would be an excellent example of how NOT to generate random numbers. At the very least, you have to call srand() first and feed it a (hopefully randomly-generated) number, or else you will always get the same output from rand() (usually, as if you had called srand(0) first).

I hope your previous 24,753 posts were somewhat more scintillating. Or perhaps preceded by you actually reading the thread you were posting in. :p
 

smack Down

Diamond Member
Sep 10, 2005
4,507
0
0
Originally posted by: sao123
Originally posted by: BrownTown
Well, it should be noted that nothing is really random. IF you were able to take into account every variable in the equations used then you could predict the outcomes. Its just that in natural phenomenon there are too many variables to actually predict the outcome. If you really knew everything involved then you could crack an algorithm even if it was based on something seemingly random like readioactive decay.



ahhh... so you can tell me the precise location and velocity vector of an electron?
I thinks NOT!!!

Not knowing the position and velocity of an electron doesn't mean it is random.
 

her209

No Lifer
Oct 11, 2000
56,336
11
0
Originally posted by: Matthias99
Originally posted by: her209
variable = rand();
That would be an excellent example of how NOT to generate random numbers. At the very least, you have to call srand() first and feed it a (hopefully randomly-generated) number, or else you will always get the same output from rand() (usually, as if you had called srand(0) first).

I hope your previous 24,753 posts were somewhat more scintillating. Or perhaps preceded by you actually reading the thread you were posting in. :p
A real rand() function would have taken care of it all for you. :p