## Pseudo Random Number

Every random experiment results in two or more outcomes.

A variable whose values depend upon the outcomes of a random experiment is called a random variable denoted by capital letters *X*, *Y*, or* Z* and their values by the corresponding small letters *x, y* or *z*.

**Random Numbers and their Generation**

Random numbers are a sequence of digits from the set {0,1,2,⋯,9} so that, at each position in the sequence, each digit has the same probability 0.1 of being selected irrespective of the actual sequence, so far constructed.

The simplest ways of achieving such numbers are games of chance such as dice, coins, cards or by repeatedly drawing numbered slips out of a jar. These are usually grouped purely for the convenience of reading but this would become very tedious for long runs of each digit. Fortunately, tables of random digits are widely available now.

A **Pseudo-Random Process** is a process that appears to be random but actually, it is not. **Pseudo-random sequences** typically exhibit statistical randomness while being generated by an entirely deterministic causal process. Such a process is easier to produce than a genuinely random one and has the benefit that it can be used again and again to produce exactly the same numbers and they are useful for testing and fixing software.

For implementation on computers to provide a sequence of such digits easily, and quickly, the most common methods are called Pseudo Random Technique.

Here, the digit will re-appear in the same order (cycle) eventually. For a good technique, the cycle might be tens of thousands of digit long.

Of course, the pseudo-random digits are not truly random. In fact, they are completely deterministic but they do exhibit most of the properties of random digits. Generally, their methods involve the recursive formula e.g.

\[X_{n+1}= a x_n +b\, mod\, m; n=0, 1, 2, …\]

*a*, *b* and *n* are suitably chosen integer constants and the seed $x_0$ (a starting number i.e. *n = 0*) is an integer. (Note mode $m$ means that if the result from the formula is greater than *m*, then divide it by *m* and keep the remainder as a random number.

Use of this formula gives rise to a sequence of integers each of which is in the random 0 to *m – 1*.

**Example**

let *a = 13*, *b=5*, and *m = 1000*, Generate 500 random numbers.

**Solution**

\[x_{n+1}=a x_n \,b\, mod\, 1000; n=0,1,2,…\]

let seed $x_0=5$, then for *n=0* we have

\begin{align*}

x_{0+1}&=13 \times 5 +5\, mod\, 1000=70\\

x_{1+1}&=13 \times 70 + 5\, mod\, 1000=915

\end{align*}

**Application of Random Variables**

The random numbers have wide applicability in the simulation techniques (also called Monte Carlo Methods) which have been applied to many problems in the various sciences and one useful in the situation where direct experimentation is not possible, the cost of conducting an experimetn is very high or the experiment takes too much time.

**R code to Generate Random Number**

# store the pseudo random output

rand.num<-numeric(500)

rand.seed<-5

for(i in 1:500){

rand.seed<-13*rand.seed+5

rand.num[i]<-rand.seed%%1000

}

rand.num

Read more about Pseudo Random Process | Random Number Generation and Linear Congruential Generator (LCG)

Read more on Wikipedia: Pseudo Randon Numbers generator