Friday 14 September 2012

What is Random Number??


It is hard to define a random number, actually there is no mathematical way to define a random number completely. In subjective we can say that:

         "A set where each of the element has equal probability of occurrence"

                     "A sequence in which each term is unpredictable"

The strength of random number is depend on the amount of information it carry, for example:
suppose that there two number one having infinite length and other having finite length  ".....1111111111......" and 11011111100111011. the first one consist of negligible information,while the second one has some significant information. So we can say that, randomness does not depend on the length of  a number but it depends on the information carried by it.

How to generate random number??       

    As we know some traditional method of generating random number such as flipping of coin, rolling of dice, shuffling of coin etc. But in the present world life is nothing without a computer. It is one of the basic need of Human Beings.

So how a computer is able to generate a random number? as it follows blindly its instructions.Without any input how it is able to generate random number? lets discuss it.

There are two methods to generate random number in a computer:
1. Pseudo random number generator.
2. True Random number generator.

Pseudo random number generator:  

"Anyone who considers arithmetical 
                                        methods of producing random digits is,
                                                                               of course, in a state of sin."  
 It is a algorithm of generating sequence of number that exhibit properties of random   number.But in technical terms it is nothing more than a "jugaad".

In PRNG, it generate a random number is generated using a 'seed' ( which is usually date and time) . On the basis of the seed, it do its calculation and produces  a sequence. And after some values it start repeating its cycle, it means that they are periodic.

There are several method of generating pseudo random number:
  •      Linear Congruential Generator
  •       Lagged Fibonnaci Generator
  •    Shift Register Generator
  •    Combined Generators 

Lets start with  the most easiest  one..

Linear Congruential Generator:

 LCG generate the next value using the previous one.

Xi=(aX i-1+c)  Mod  m
where a is multiplier,c is addend and Mis modulous and X is 'seed'..

Let  a=1,c=5,m=16 and X0=1




With Pseudo random number generator  it is easy to generate random number with low cost and it generate the random numbers with the velocity of light.. means at very fast speed.

Now..how our Modern computer generate random number..


but..but...there is a problem with Pseudo random number, means our jugaad gets fails when, one knows our key i.e. seed. One will be able to detect what is our number if he know seed.

There are some factors by which we can produce a random number of appropriate quality:

Uncorrelated Sequences - The sequences of random numbers should be serially uncorrelated.

Long Period –The generator should be of long period.

Uniformity - The random numbers should be uniformly distributed within a specified region.

Efficiency - As literally millions or even billions of random numbers are required in a large-scale simulation, the generator should be efficient.

Now, leave  jugaad and focus on generating true random number..


True random number:

                        "It is impossible to predict the unpredictable."

True random generator generate the random number from physical source,such as thermal 
noise,photoelectric effector, quantum mechanics etc... 

A hardware random number generator typically consists of a transducer to convert some aspect of the physical phenomena to an electrical signal, an amplifier and other electronic circuitry to increase the amplitude of the random fluctuations to a macroscopic level, and some type of analog to digital converter to convert the output into a digital number, often a simple binary digit 0 or 1. By repeatedly sampling the randomly varying signal, a series of random numbers is obtained.

In theoretical TRNG produce complete random number. As it solve the problem of PRNG  of security of key and produces good quality of random number,but..there is also a problem with TRNG they are very slow.


Applications..

Random number has wide application in every field....some of them are..
1.Simulation
2.Network Security
3.Data Encryption
4.Digital Signature
5.Gambling/Casino
6.Recreation/Games
7.Protocols
etc.................



So both method have their pros. and cons.  
According to the need they use. In Monte-Carlo simulation speed is major factor, so in this case pseudo random number is uses. 
While in digital signature for private key security is major factor  true random number are  use. 
In cryptography hybrid of them is use, means true random number gives seed and  and with this seed pseudo random number is produced.

And with various tests we can test the quality of random.