Weitere ähnliche Inhalte Ähnlich wie Pseudo Random Number Generators (20) Mehr von Darshini Parikh (8) Kürzlich hochgeladen (20) Pseudo Random Number Generators2. ©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.
9. ©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
10. ©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}
13. ©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)
14. ©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
17. ©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…
18. ©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)
23. ©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