Robotics C++ Physics II AP Physics B Electronics Java Astronomy Other Courses Summer Session  

Random Number Generators

 

¢ Truly random versus pseudo random number generator

 

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.

 

¢ 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).

 

¢ An example written in the C language

 

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

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.

 

¢ Additional Information

 

Randomness for Crypto

http://www.cs.berkeley.edu/~daw/rnd/

 

Random Number Generators

http://cnscenter.future.co.kr/crypto/algorithm/random.html