30
Random- number generatorS & reVIEW ON Intel rng Presented by syed atif chishti IE 508 – SYSTEM SIMULATION & MODELING

Random number generator

Embed Size (px)

Citation preview

Page 1: Random number generator

Random- number generatorS& reVIEW ON Intel rng

Presented by syed atif chishti

IE 508 – SYSTEM SIMULATION & MODELING

Page 2: Random number generator

overview

Topics to be covered

1. Introduction

2.Linear Congruential Generators3. Composite Generators4.Testing Random-Number Generator

5. Intel Random Number Generator

Page 3: Random number generator

Introduction

A simulation of process in which random Component requires

A method of generating Numbers that are random

Methods of generating random variates from uniform distribution

On the interval [0 1] denoted as U(0,1)

Random variates generated from U(0,1) distribution will be

Called as random numbers.

Page 4: Random number generator

Introduction

Casting lots, throwing dice, dealing out cards

Electronic random number indicator equipment(ERNIE)

Was used by British GPO to pick winners in lottery

.

Page 5: Random number generator

Mid square method

.

Page 6: Random number generator

Properties of Arithmetic rng

It is distributed uniformly on U(0,1).No correlation.

Fast and avoid the need of storage.

Stream reproduce second times.

Produce separate streams easily

Generator to be portable i.e produce the number up to

Machine accuracy.

.

Page 7: Random number generator

Linear congruential generators

It can be defined by the recursive formula

Z=(az+c)(mod m)

M= modulus

A= multiplier

C= increment

Z= seed or starting value

U= Z/m

.

Page 8: Random number generator

Objection on lcg

Pseudo random number generator as Z is completely

Determined by m,a,c,z parameter.

U’s can take only the rational values 0,1/m,2/m,…,(m-1)/m

Page 9: Random number generator

example

M=16, a=5,c=3 & Z=7.

Page 10: Random number generator

Mixed generator

Conditions to get full period of a generator.

Only positive integer that divides both m and c is 1.

If q is a prime number that divides m, then q divides a-1.

If 4 divides m,then 4 divides a-1.

For C>0 ,condition 1 is possible and we get full period.

M=2expb, since b is the bits(binary digits) to store the data.

Page 11: Random number generator

Multiplicative generators

C is not needed.

Don’t have full period, condition 1 not satisfied.

M=2expb-2, only one fourth of integers 0-m-1 can be obtain

If a= 2exp l + J then it is called RANDU.

Prime modulus multiplicative LCG(PMMLCG)

M is prime and the period is m-1 and if a is primitive

Element modulo m i.e smallest integer l for which al-1/m

Gives l=m-1.

.

Page 12: Random number generator

Alternatives types to LCG

It can be expressed as

Z=g(Zi-1,Zi-2,…)(mod m) = a’z^2+az+c

Similar to midsquare method

Better statistical properties

Period of QCG=m

.

Quadratic Congruential Generator

Page 13: Random number generator

Alternatives types to LCG

Two or more separate generators and combine them to

Generate the final random numbers.

Second LCG to shuffle the output from the first LCG

Initially a vector V=(v1,v2,,,,,vk) is filled sequentially with the

First KU from the first LCG where k=128 and second LCG is

Used to generate a random integer I distributed uniformly.

V1 returns as first U(0,1) variate ,first LCG replaces its Ith

Location in V with the next U and second LCG randomly

Chooses the random number from this updated V

COMPOSITE GENERATORS

Page 14: Random number generator

Alternatives types to LCG

These generators are called cryptographic ,operate directly

On bits to form random numbers.

Bi=(c1bi-1+c2bi-2+….+cqbi-q)(mod 2)

c1=c2=cq-1= 0 or 1

Cq=1

In most application c =0 thus it become

Bi=(bi-r+bi-q)(mod2)

Or

Bi=[ 0 if bi-r = bi-q , 1 if bi-r not= bi-q]

FEEDBACK SHIFT REGISTER GENERATORS

Page 15: Random number generator

Testing Random-Number Generators

Empirical test are the kinds of statistical tests and are

based on U’s Produced by generator.

Theoretical test use numerical parameters of a generator

To assess it globally without actually generating U’s

.

EMPIRICAL TESTS VS THEORETICAL TEST

Page 16: Random number generator

EMPIRICAL TESTS

The direct way to test any generator is to generate some

U’s and then statistically examined to see the result to

IID U(0,1)

Test 1 Chi – Square method:

Check whether U’s appear to be uniformly distributed b/w 0 & 1

Divide the [0,1] into k sub intervals of equal length &

Generate U1,U2,U3….Un

Page 17: Random number generator

EMPIRICAL TESTS

Test 2 Serial Test method: Generalization of Chi-square test to higher dimension.

If the U’s are really from IID U(0,1) random variates, the overlap

D –tuples is

U1=(U1,U2,…,Ud), U2=(Ud+1,Ud+2,…,U2d) …..

Should be IID random vectors distributed uniformly on the d

Dimensional unit hypercube [0,1]d.

Divide [0,1] into k subintervals of equal size and generate U1,

U2,….Un.

Page 18: Random number generator

EMPIRICAL TESTS

Test 3 runs (runs –up) test: Examine the Ui sequence for unbroken sequence of maximal

Length with in which the Ui’s increase monotonically Such

Subsequence is called a run up.

Let U1,U2…U10 : 0.86,0.11,0.23,0.03,0.13,0.06,0.55,0.64,0.87

0.10. the sequence starts with run up of length 1(0.86) followed

By run up of length 2(0.11,0.23) then run up of length 2(0.03,0.13)

Then a run up of length 4(0.06,0.55,0.64,0.87) and finally run up

Of length 1(0.10)

R=1/n ∑∑aij(ri-nbi)(rj-nbj)

Page 19: Random number generator

EMPIRICAL TESTS

Test 4 Discernible correlation:

Estimate the generated Ui’s correlation at lags j=1,2…l.

It is defined as Pj= Cj/Co

Where Cj =COV (Xi,Xi+j)= E(XiXi+J)-E(Xi)E(Xi+j)

Covariance between entries in the sequence separated by j.

Page 20: Random number generator

THEORETICAL TESTS

Best known theoretical test are based on upsetting

observation that random numbers fall mainly in the planes.

.

Page 21: Random number generator

True Random Number Generator

Uses a non deterministic source to produce randomness.

It measuring unpredictable natural process such as thermal

(resistance or shot) noise or nuclear decay.

INTEL RANDOM NUMBER GENERATOR

Page 22: Random number generator

True Random Number Generator

Uses a non deterministic source to produce randomness.

It measuring unpredictable natural process such as thermal

(resistance or shot) noise or nuclear decay.

Through mouse movement ,keys can be generated.

INTEL RANDOM NUMBER GENERATOR

Page 23: Random number generator

Architecture Analysis Of Intel RNG

Page 24: Random number generator

Noise Source: Johnson noise also called thermal noise ,shot noise and

Flicker noise are all present in resistor.

They have electrically measurable characteristics and are the

Result of random electron & material behavior.

Intel RNG first samples thermal noise by amplifying the voltage

Measured across resistor.

Apart from large random component , this measurement are

Correlated to electromagnetic radiation,temperature and power

Supply fluctuation.

Intel RNG reduces the coupled component by subtract the

signals sampled from two adjacent resistor.

Page 25: Random number generator

Dual Oscillator Architecture :

Intel RNG uses a random source that is derived

from two free –running oscillator. one is fast and

one is slow.

Thermal noise source use to modulate the

Frequency of slower clock

The variable, noise modulated slower clock is used

To trigger the measurement of fast clock.

Drift between the two clocks thus provides the

Source of random binary digits.

Page 26: Random number generator

Digital Post Processing :

The initial random measurement are processed by hardware

Corrector based concept to produce a balanced distribution

Of 0 & 1 bits.

Page 27: Random number generator

Statistical Evaluation :

Intel RNG uses a random source that is derived

from two free –running oscillator. one is fast and

one is slow.

Thermal noise source use to modulate the

Frequency of slower clock

The variable, noise modulated slower clock is used

To trigger the measurement of fast clock.

Drift between the two clocks thus provides the

Source of random binary digits.

Page 28: Random number generator

Intel Software Library

Software Architecture

Page 29: Random number generator
Page 30: Random number generator

Thank you