Random Numbers

Discussion in 'Physics & Math' started by spacemanspiff, Mar 14, 2003.

  1. spacemanspiff czar of things Registered Senior Member

    Messages:
    823
    I was using this random number generator on my computer and someone told me that it "wasn't really random". I assume that means that there is some pattern to the numbers it gives you, however sligt this pattern may be it's "nearly random".

    My question is, given enough generated numbers wouldn't you be able to discern some sort of partern from any random number generator.

    Is there a purely random number generator or is the idea of randomness more theoretical and difficult to actually atain.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. lethe Registered Senior Member

    Messages:
    2,009
    your friend is right. the random number generator of a computer is not truly random. if you analyzed the data enough, you could discern some pattern.

    computer scientests try long and hard to find algorithms which make the random number generator as random as possible though, so it is very very difficult to notice the nonrandomness of it.

    as to your question of whether a truly random source of numbers can really be made, the answer is probably yes. according to the modern interpretations of quantum mechanics, certain quantum events are truly random, in a way that the best computer random number generator is not.

    if you knew the algorithm of the computer (which you could probably find in the specs of the machine somewhere), you could predict its values. but you can never predict with certainty the outcome of certain quantum events, like, say, the decay of a uranium nucleus, or many other events.

    in principle you could rig up your computer so that it generated random numbers based on quantum events.

    perhaps you have heard of quantum computers? this is what they are, although in that case, the goal is not to seek better random number generators, but a quantum computer is a computer that relies on quantum fluctuations, rather than deterministic electronic circuit flows, which can never have inherent randomness.
     
    Last edited: Mar 18, 2003
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Prosoothus Registered Senior Member

    Messages:
    1,973
    spacemanspiff,

    I honestly believe that true randomness doesn't exist. Therefore, it would be impossible to make a truly random number generator.

    However, if you make a computer program that uses the temperature of the CPU as a seed for a random number generator, then you won't be able to discern a pattern from the numbers generated (because the pattern would be too complex).

    Tom
     
    Last edited: Mar 14, 2003
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    I was reading an academic paper (don't remember where...wish i had a better memory) about a software implementation to improve the randomness of pseudo-random number generators in *nix systems. They use conventional pseudo-random number generators which are pretty good anyway and seed them not with time, but with a number generated by something within the OS itself...it was the task scheduler or something like that. But the effect was that the pseduo-random number generator never patterened because it was seeded with random numbers.

    -AntonK
     
  8. James R Just this guy, you know? Staff Member

    Messages:
    39,421
    I think that many computers use the CPU clock to generate pseudorandom numbers. The actual random numbers are usually generated by taking the remainder after division by a large number.
     
  9. snakeyez Registered Member

    Messages:
    8
    Maybe this will help.....

    There are two ways that computers can generate random numbers:

    You can create some sort of device that monitors a completely random natural event and sends its results to the computer. For example, you could place a piece of radioactive material in front of a Geiger counter and connect the Geiger counter to a computer. Since radioactive decay is random, the Geiger counter would create truly random numbers. This approach is pretty rare, because not many people have Geiger counters connected to their machines.

    You can create a formula that generates a pseudo-random number. When designing the formula, the idea is for it to produce a string of numbers that would look random to anyone who did not know what the formula is. Characteristics of a good formula include:
    No repetition: The sequence does not cycle around and repeat itself.
    Good numeric distribution: If the formula is producing random numbers between 0 and 9, the number of zeros, ones, twos, etc. that it produces should be roughly equal over a long period of time.
    Lack of predictability: You have no way to predict what the next number will be unless you know the formula and the seed (the initial value).
    Here's an example of a simple random-number formula from the book "The C Programming Language," by Kernighan and Ritchie:


    int rand()
    {
    random_seed = random_seed * 1103515245 +12345;
    return (unsigned int)(random_seed / 65536) % 32768;
    }

    [See How C Programming Works for more information on the C programming language.]

    This formula assumes the existence of a variable called random_seed, which is initially set to some number. The random_seed variable is multiplied by 1,103,515,245 and then 12,345 gets added to the product; random_seed is then replaced by this new value. This is actually a pretty good pseudo-random number generator. It has a good distribution and it is non-repeating. If you use it to produce random numbers between 0 and 9, here are the first 20 values that it produces if the seed is 10:


    4
    4
    6
    0
    7
    4
    2
    3
    5
    0
    5
    6
    6
    4
    5
    6
    7
    6
    7
    4

    If you have it produce 10,000 values between 0 and 9, here's the distribution:


    0 - 1015
    1 - 1024
    2 - 1048
    3 - 996
    4 - 988
    5 - 1001
    6 - 996
    7 - 1006
    8 - 965
    9 - 961

    Any pseudo-random number formula depends on the seed value to start the sequence. If you start with the same seed, you will get the same sequence of values from the formula. So if you give the rand() function shown above the seed of 10 on one computer and look at the stream of numbers it produces, it will be identical to the stream of numbers produced on any computer that runs it with a seed of 10. In the case of the Global Positioning System, this reproducibility is used as a way to give each satellite a predictable but different pattern of values that the GPS receiver can track.

    To create a random and unpredictable sequence, the seed must be a truly random number. To get this truly random number for the seed, most programs use the current date and time, converted to an integer value (for example, converted to the number of seconds that have elapsed since January 1, 1970). Since this is a different number every time you start the program, it makes a good seed.

    http://computer.howstuffworks.com/question697.htm
     
  10. malisha Registered Senior Member

    Messages:
    64
    there is an entropy pool which some random generators use. in the entropy pool things like mouse clicks, cpu cycles and many different types of events are recorded and a number is generated, this number can then be used as the seed.

    Yes this isnt trully random because you could duplicated the events that go into the entropy pool, but it would be might hard to do some of them again.
     
  11. one_raven God is a Chinese Whisper Valued Senior Member

    Messages:
    13,433
    If you were to use something like an algorithm utilizing the current temperature in Guam, the number of seconds that have elapsed since the computer was turned on, the number of bytes that have been transferred to and from your NIC today and the current barometric pressure in Seattle, Wa...

    Would it then be considered truly random?

    Is the roll of a die considered truly random?
     
  12. malisha Registered Senior Member

    Messages:
    64
    no they arnt because there are known steps used to get to that number no matter how small the steps maybe, is you could do these steps again then apply the algorithm you can get that number again, its just some of these events are so hard to duplicate .. for all intensive purposes u can classify the number that is generated as random
     
  13. ProCop Valued Senior Member

    Messages:
    1,258
    Truly random means having no (traceable) past. Because the future has no traceable past the future is truly random (before it happens).
     
  14. SciBoy Registered Senior Member

    Messages:
    34
    In my opinion true randomness cannot exist.

    for a generator such as the one suggested by snake eyz works well. But the seed would also have to be random for it to be truly random. Therefore another generator would have to be used, and so on so forth. The more generators the more random however we would never reach randomness. So only an infinite number of generators supplying seeds to the next would cause true randomness. So its theoretical. For practical purposes tho, even 1 or two would suffice.

    Just thinking or am I talking balderdash. lol
     
  15. hlreed Registered Senior Member

    Messages:
    245
    Any time you have a problem that is not solvable and causes back and forth aurguments, you can almost bet there is a hidden adjective that is trying to be defined. Notice that random must have a noun after it to make random numbers. Random by itself has no meaning. (Same thing with intellegence which is an abstract noun. Why AI does not work.)
    Abstract means you cannot make a model of it.
    The random numbers that a computer makes are chaos, which is digit rollover and does not produce random numbers.

    Random cannot be defined.
     
  16. SciBoy Registered Senior Member

    Messages:
    34
    I liked that point. Looking at the dictionary (which I really do), I see that the word random is only an adj. which suggests that random by itself means nothing. We can only say that something has a certain amount of randomness.

    Randum Numbers as I undestand is defined as: A assigned real number between two limits that has an equal chance of being any real number between those two points.

    Dunno how that helped but I thought I'd give a english look into it.

    It seems that true randomness is only theoretical as I said before.
     
  17. Fluidity Registered Senior Member

    Messages:
    594
    Idea for a random number generator

    Within the framework of a 3-dimensional computer rendered envioronment, construct a 10 sided die with a perfectly elastic weightless ball inside it. As a function of time and the velocity of the ball, the sides of the die change size and proportion to the other sides, causing a change in the angles of reflection for the bouncing ball within. The die bounces with a perfectly elastic collision, weightless in a sphere with a fractal landscape interior that is constantly changing as a function of the velocity of the ball and time. Each time the ball within the die strikes a surface, it is representative of a number 0-9. Also, each time the ball strikes a surface in the die, the surface is reordered as a function of time and distance from the epicenter of the sphere that contains the die.

    This could be done relatively easily in OpenGL. The program would run quickly if the rendered detail was kept low enough.
    Would this generate an almost perfectly random sequence?
     
  18. SciBoy Registered Senior Member

    Messages:
    34
    It seems that the eternal problem is the seed, or first number. I'm not sure I quite grasp fluiditys opengl idea, (it sounds great by the way), mathematically which is what we are all interested in, a random number formula or function must have an input and that too must be random. Would your idea, fluidity give you a random seed?
     
  19. Fluidity Registered Senior Member

    Messages:
    594
    I suppose...

    Because, the sequence is always running. If you want a sequence of 12 random numbers for example, you hit enter and it begins recording the sequence, which is continually being generated. You have to start from somewhere, but once it has begun, you can tap into it any time. Each beginning sequence would be completely different if we take year, day, hour, and minute into account for the function of time to determine the geometry of the die.
     
  20. Fluidity Registered Senior Member

    Messages:
    594
    I suppose...

    Because, the sequence is always running. If you want a sequence of 12 random numbers for example, you hit enter and it begins recording the sequence, which is continually being generated. You have to start from somewhere, but once it has begun, you can tap into it any time. Each beginning sequence would be completely different if we take year, day, hour, and minute into account for the function of time to determine the geometry of the die.
     
  21. hlreed Registered Senior Member

    Messages:
    245
    Here is how to make a fool proof random number.

    Take the number 3. Say "That is a random number".
    There you are.
     
  22. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    That was a pointless post.

    -AntonK
     
  23. Bebelina kospla.com Valued Senior Member

    Messages:
    5,036
    This is very interesting, how does one measure randomness, and if it can be measured is it still considered random?
     

Share This Page