by Scoundral on April 24th, 2005

Scoundral

Question

Help answer this question below.

If computers work in logic, how do you program a computer to generate random numbers?

Answers. Showing one answer.

  • by ErikMartin on October 11th, 2006

    ErikMartin

    To research these types of random numbers, do a search on PRNG, which stands for "pseudo-random number generator", which is the first, purely logical, type; and "entropy accumulation" which is the second type. The difficulty with the second type is that you've got to figure out how much randomness (entropy) you're gathering. For example, if you want to get a random 32-bit number, and you want to get it by collecting the randomness off the hum of your sound card, you're going to need to know how long you need to listen to that hum before you have 32 bits worth of randomness. Once you've figured that out, the process is to feed all the data from the hum (or the keyboard input, or whatever), into a hash function, which does the actual "accumulation" and outputs your 32-bit number, once you've determined it has enough data for that number to be valid. (And then you can continue feeding it data for your next 32-bit number.)

    Comments
    • You also need to be careful with that hash function - it could "derandomize" the values by statistically weighting the results of the entropy data in a non-linear fashion, effectively "bunching up" the results around certain loci. The hash function needs to be evaluated against the expected data stream to flatten out anticipated regularities and/or inequalities in distribution of the "entropy values" across the working space.

      Eli Jerusalem

      by Eli Jerusalem on February 18th, 2007

    • Like
    • Report

    1 comment | Post one | Permalink

Want to attach an image to your answer? Click here.

Did this answer your question? If not, then ask a new question or create a poll.

You're reading If computers work in logic, how do you program a computer to generate random numbers?

Follow us on Facebook!

Related Ads