SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
©TechKnowXpress
PSEUDO RANDOM
NUMBER GENERATION
-DARSHINI PARIKH
(TechKnowXpress)
©TechKnowXpress
WHAT ARE PSEUDO RANDOM
NUMBERS(PRNs)?
• Deterministic Algorithms used to generate a sequence of numbers that are
not statistically random.
• Good algorithms pass a number of tests of randomness.
©TechKnowXpress
RANDOMNESS
• Uniform Distribution – frequency of occurrence of numbers
• Independence – inference of a subsequence should not be possible
©TechKnowXpress
CONGRUENTIAL GENERATOR
FOUR TYPES LINEAR CONGRUENTIAL GENERATOR
(LCG)
MULTIPLICATIVE CONGRUENTIAL GENERATOR
(MCG)
QUADRATIC CONGRUENTIAL GENERATOR
(QCG)
INVERSIVE CONGRUENTIAL GENERATOR
(ICG)
©TechKnowXpress
MCG
• Recurrence Relation:
Xn+1 = (a* Xn +c) mod m
a=Multiplier
c= Increment = 0 (ZERO)
m=modulus
• Xn+1 = (a* Xn ) mod m
©TechKnowXpress
MCG EXAMPLE
Eg: X0 = a = c = 7
m = 10
PRNs generated:
7, 6, 9, 0, 7, 6, 9, 0, ...
Eg: m=231
Range of PRNs – {0 - 231}
©TechKnowXpress
MCG Example (conti…)
a = 13
c = 0
m = 64
©TechKnowXpress
LCG
Recurrence Relation:
Xn+1 = (a* Xn +c) mod m
a=Multiplier
c= Increment
m=modulus
©TechKnowXpress
SELECTING ‘a’ IN LCG
FOR GENERATINGANY LCG
a belongs to:
{0 – m}
FOR GENERATING FULL
PERIOD LCG
(i) (a-1) should be
divisible by all prime
numbers of m.
(ii) (a-1) should be
divisible by 4 if m is
divisible by 4
©TechKnowXpress
SELECTING ‘m’ & ‘c’ IN LCG
SELECTING M
(i) M should be large
(ii) For efficient
computation; m should
be a power of 2.
SELECTING C
C belongs to {0 to m}
©TechKnowXpress
LCG Example
Xn+1 =65539Xn mod 231
This PRNG generates a full period sequence
©TechKnowXpress
QCG
RECURRENCE RELATION:
Xn+1 = (a* X2
n + b*Xn + c) mod m
a, b – multipliers
c - increment
m - modulus
©TechKnowXpress
CRITERIA FOR FULL PERIOD SEQUENCE
 gcd(m,c) = 1; m and c are
relatively prime
 a,b =0 (mod p);p = odd
prime divisor of m
 a=0 (mod 2) and
b=(a+1) (mod 4) if 4|m or
b=(a+1) (mod 2) if 2|m
 if 9|m then either a=0
(mod 9) or b=1 (mod 9)
and ac=6 (mod 9).
 m=2p
 c = 1 (mod 2) => c is odd
 a = 0 (mod 2) => a is even
 b= (a+1) (mod 4)
©TechKnowXpress
QCG Example
Xn+1 = (12*Xn
2 + 25* Xn + 11) % 36
X0 = 13
Corresponding equation:
Now , 36 – (22 * 32)
Criteria satisfied:
gcd (c,m) = 1 (gcd(11,36) = 1)
a % 2 = a % 3 =0 (a=12)
b % 2 = b % 3 = 1 (b=25)
b = a+1 (mod 4) (25=13 (mod 4))
a*c = 6 (mod 9) (12*11 = 6 (mod 9))
This PRNG will generate a full period sequence
©TechKnowXpress
ICG
RECURRENCE RELATION:
X(n+1) = a*X-1
n + c (mod m)
a – multiplier
c – increment
m - modulus
©TechKnowXpress
CRITERIA FOR FULL PERIOD SEQUENCE
POLYNOMIAL:
X2 - c*X – a
should be a primitive
polynomial over Fm.
(Inversive Maximum
Polynomial (IMP).)
©TechKnowXpress
ICG Example
Eg: X(n+1) = 2*X-1
n + 3 (mod m)
Corresponding Equation: X(n+1) = a*X-1
n + c (mod m)
IMP : Xn
2 -3 * Xn -2= Xn
2 + 4* Xn + 5 (mod 7) is a primitive polynomial over F7.
This PRNG will generate a full period sequence
Sequence generated: 1,5,2,4,0,3,6,1…
©TechKnowXpress
Lagged Fibonacci Generator (LFG)
RECURRENCE RELATION:
Xn = (X(n-L) * X(n-k)) mod m
Given – L bits of the sequence
k, L – lags
m = 2M
Period of the Generator = (2L-1)*(2M-1)
LFG Notation: LFG(L, k, M)
©TechKnowXpress
LFG Example
Eg: LFG (17,5,31)
So the period of this sequence will be approx. 247
247 = (217) * (2(31-1))
©TechKnowXpress
LFSR
©TechKnowXpress
LFSR Example
Suppose m – 24 -1
Initial value: 1000
Sequence: 1000, 1001, 1010,
1111,…
©TechKnowXpress
MersenneTwister
RECURRENCE RELATION
X(k+n) = X(k+m) ⊕ (Xu
k | XL
(k+1)) • A
A – w x w matrix
r - 0< r <w-1
m – 1< m <n
k – {0,1,….}
u – higher order bits = w-r bits
L – lower order r bits
| - Concatenation Operation
©TechKnowXpress
BLUM BLUM SHUB GENERATOR
RECURRENCE RELATION:
Xn+1 = X2
n % m
X0 = S2 % m
Bn+1 = Xn+1 % 2
S – Seed value
m – modulus – p*q (p & q are large primes such that p=q=3 (mod 4))
B – BBS bit
©TechKnowXpress
BBSG Example
Eg: p- 383, q – 503, S = 101355
m =192649 = 383 * 503
The sequence generated is:
©TechKnowXpress
ANSI X9.17
©TechKnowXpress
ANSI X9.17 (conti…)
RECURRENCE RELATION:
Ri = EDE([K1,K2], [Vi ⊕ EDE([K1,K2],DTi)])
Vi+1 = EDE([K1,K2], [Ri ⊕ EDE([K1,K2],DTi)])
©TechKnowXpress
APPLICATIONS OF RANDOM NUMBERS
CRYPTOGRAPHY
STATISTICAL
SAMPLING
GENERATION
OF
INITIALIZATION
VECTORS
SIMULATIONS
GAMBLING
&
LUCKY
DRAWS
©TechKnowXpress
APPLICATIONS OF PRNGSs
GENERATION
OF SESSION
KEYS
GENERATION
OF PUBLIC
KEYS
GENERATIONOF
NONCETOAVOID
REPLAYATTACKS
©TechKnowXpress

Weitere ähnliche Inhalte

Was ist angesagt?

Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 

Was ist angesagt? (20)

EULER AND FERMAT THEOREM
EULER AND FERMAT THEOREMEULER AND FERMAT THEOREM
EULER AND FERMAT THEOREM
 
Elliptical curve cryptography
Elliptical curve cryptographyElliptical curve cryptography
Elliptical curve cryptography
 
hill cipher
hill cipherhill cipher
hill cipher
 
Digital Signature.ppt
Digital Signature.pptDigital Signature.ppt
Digital Signature.ppt
 
Primality
PrimalityPrimality
Primality
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSA
 
Random number generation
Random number generationRandom number generation
Random number generation
 
Vigenere cipher
Vigenere cipherVigenere cipher
Vigenere cipher
 
IP Security
IP SecurityIP Security
IP Security
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
 
ElGamal Encryption Algoritham.pptx
ElGamal Encryption Algoritham.pptxElGamal Encryption Algoritham.pptx
ElGamal Encryption Algoritham.pptx
 
RSA Algorithm
RSA AlgorithmRSA Algorithm
RSA Algorithm
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theorem
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
MD-5 : Algorithm
MD-5 : AlgorithmMD-5 : Algorithm
MD-5 : Algorithm
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Elliptic Curves and Elliptic Curve Cryptography
Elliptic Curves and Elliptic Curve CryptographyElliptic Curves and Elliptic Curve Cryptography
Elliptic Curves and Elliptic Curve Cryptography
 
DES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentationDES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentation
 

Andere mochten auch (6)

Input modeling
Input modelingInput modeling
Input modeling
 
Random variate generation
Random variate generationRandom variate generation
Random variate generation
 
Pseudorandom number generators powerpoint
Pseudorandom number generators powerpointPseudorandom number generators powerpoint
Pseudorandom number generators powerpoint
 
Simulation in terminated system
Simulation in terminated system Simulation in terminated system
Simulation in terminated system
 
Random Number Generation
Random Number GenerationRandom Number Generation
Random Number Generation
 
Generate and test random numbers
Generate and test random numbersGenerate and test random numbers
Generate and test random numbers
 

Ähnlich wie Pseudo Random Number Generators

Multiplicative Interaction Models in R
Multiplicative Interaction Models in RMultiplicative Interaction Models in R
Multiplicative Interaction Models in R
htstatistics
 

Ähnlich wie Pseudo Random Number Generators (20)

Subquad multi ff
Subquad multi ffSubquad multi ff
Subquad multi ff
 
Talk at SciCADE2013 about "Accelerated Multiple Precision ODE solver base on ...
Talk at SciCADE2013 about "Accelerated Multiple Precision ODE solver base on ...Talk at SciCADE2013 about "Accelerated Multiple Precision ODE solver base on ...
Talk at SciCADE2013 about "Accelerated Multiple Precision ODE solver base on ...
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
 
Different Types of Machine Learning Algorithms
Different Types of Machine Learning AlgorithmsDifferent Types of Machine Learning Algorithms
Different Types of Machine Learning Algorithms
 
SPDE presentation 2012
SPDE presentation 2012SPDE presentation 2012
SPDE presentation 2012
 
Lecture9 xing
Lecture9 xingLecture9 xing
Lecture9 xing
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Novel Performance Analysis of Network Coded Communications in Single-Relay Ne...
Novel Performance Analysis of Network Coded Communications in Single-Relay Ne...Novel Performance Analysis of Network Coded Communications in Single-Relay Ne...
Novel Performance Analysis of Network Coded Communications in Single-Relay Ne...
 
Response Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty QuantificationResponse Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty Quantification
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Multiplicative Interaction Models in R
Multiplicative Interaction Models in RMultiplicative Interaction Models in R
Multiplicative Interaction Models in R
 
Doubly Accelerated Stochastic Variance Reduced Gradient Methods for Regulariz...
Doubly Accelerated Stochastic Variance Reduced Gradient Methods for Regulariz...Doubly Accelerated Stochastic Variance Reduced Gradient Methods for Regulariz...
Doubly Accelerated Stochastic Variance Reduced Gradient Methods for Regulariz...
 
"Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL.""Mesh of Periodic Minimal Surfaces in CGAL."
"Mesh of Periodic Minimal Surfaces in CGAL."
 
Ece4510 notes09
Ece4510 notes09Ece4510 notes09
Ece4510 notes09
 
MUMS: Bayesian, Fiducial, and Frequentist Conference - Model Selection in the...
MUMS: Bayesian, Fiducial, and Frequentist Conference - Model Selection in the...MUMS: Bayesian, Fiducial, and Frequentist Conference - Model Selection in the...
MUMS: Bayesian, Fiducial, and Frequentist Conference - Model Selection in the...
 
Project seminar ppt_steelcasting
Project seminar ppt_steelcastingProject seminar ppt_steelcasting
Project seminar ppt_steelcasting
 
DAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptxDAA - UNIT 4 - Engineering.pptx
DAA - UNIT 4 - Engineering.pptx
 
GMMNに基づく音声合成におけるグラム行列の
スパース近似の検討
GMMNに基づく音声合成におけるグラム行列の
スパース近似の検討GMMNに基づく音声合成におけるグラム行列の
スパース近似の検討
GMMNに基づく音声合成におけるグラム行列の
スパース近似の検討
 
CLIM Fall 2017 Course: Statistics for Climate Research, Spatial Data: Models ...
CLIM Fall 2017 Course: Statistics for Climate Research, Spatial Data: Models ...CLIM Fall 2017 Course: Statistics for Climate Research, Spatial Data: Models ...
CLIM Fall 2017 Course: Statistics for Climate Research, Spatial Data: Models ...
 
Distributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsDistributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUs
 

Mehr von Darshini Parikh (8)

Semantic web
Semantic webSemantic web
Semantic web
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Swift
SwiftSwift
Swift
 
Cryptography
CryptographyCryptography
Cryptography
 
Online erp
Online erpOnline erp
Online erp
 
Scrum
ScrumScrum
Scrum
 
Windows 7 installation steps
Windows 7 installation stepsWindows 7 installation steps
Windows 7 installation steps
 
Android
AndroidAndroid
Android
 

Kürzlich hochgeladen

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Kürzlich hochgeladen (20)

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 

Pseudo Random Number Generators