SlideShare a Scribd company logo
1 of 12
Random number and It's
generating techniques
By
Md. Fazle Rabbi
16CSE057
4.2
Random numbers
What is random numbers ?
• A random number is a number generated by a process,
• Whose outcome is unpredictable.
• And which cannot be sub sequentially reproduced.
Random number plays important role in simulation task
4.3
Properties of random numbers
The main properties of random numbers are
• Uniformity
They are equally possible every where
• Independence
The current value of a random variable has no relation
with the previous value
4.4
Generation of Pseudo-Random Numbers
• “Pseudo”, because generating numbers using a known method
removes the potential for true randomness.
• Goal: To produce a sequence of numbers in [0,1] that
simulates, or imitates, the ideal properties of random numbers
(RN).
• Important considerations in RN routines:
• Fast
• Portable to different computers
• Have sufficiently long cycle
• Replicable
• Closely approximate the ideal statistical properties of
uniformity and independence.
4.5
Techniques for Generating Random Numbers
• Linear Congruential Method (LCM).
• Combined Linear Congruential Generators (CLCG).
• Random-Number Streams.
4.6
Linear congruential method
Proposed by Lehmer, produces a sequences of integer numbers X1 ,X2 ,
… between zero and m-1 by following the recursive relationship:
X i+1= (aXi+c) mod m, i=0,1,2,3…
• The initial value i.e. x0 is called seed
• a is called multiplier
• c is called the increment
• m is called the modulus
• If c ≠ 𝟎 then form is called mixed congruential method
• When c=0, the form is called multiplicative congruential method
,...
2
,
1
, 
 i
m
X
R i
i
4.7
Example [LCM]
• Use X0 = 27, a = 17, c = 43, and m = 100.
• The Xi and Ri values are:
X1 = (17*27+43) mod 100 = 502 mod 100 = 2, R1 = 0.02;
X2 = (17*2+43) mod 100 = 77, R2 = 0.77;
X3 = (17*77+43) mod 100 = 52, R3 = 0.52;
4.8
Combined linear congruential generators
• Reason: Longer period generator is needed because of the increasing
complexity of stimulated systems.
• Approach: Combine two or more multiplicative congruential generators.
• Let Xi,1, Xi,2, …, Xi,k, be the ith output from k different multiplicative
congruential generators.
• The jth generator:
• Has prime modulus mj and multiplier aj and period is mj-1
• Produces integers Xi,j is approx ~ Uniform on integers in [1, m-1]
• Wi,j = Xi,j -1 is approx ~ Uniform on integers in [1, m-2]
4.9
Combined linear congruential generators
• Suggested form:
• The maximum possible period is:
1
mod
)
1
( 1
1
,
1










 


m
X
X
k
j
j
i
j
i










0
,
1
0
,
Hence,
1
1
1
i
i
i
i
X
m
m
X
m
X
R

1
2
1
2
)
1
)...(
1
)(
1
(




 k
k
m
m
m
P
The coefficient:
Performs the
subtraction Xi,1-1
4.10
Combined linear congruential generators
• Example: For 32-bit computers, L’Ecuyer [1988] suggests combining k = 2
generators with m1 = 2,147,483,563, a1 = 40,014, m2 = 2,147,483,399 and a2
= 20,692. The algorithm becomes:
Step 1: Select seeds
• X1,0 in the range [1, 2,147,483,562] for the 1st generator
• X2,0 in the range [1, 2,147,483,398] for the 2nd generator.
Step 2: For each individual generator,
X1,j+1 = 40,014 X1,j mod 2,147,483,563
X2,j+1 = 40,692 X1,j mod 2,147,483,399.
Step 3: Xj+1 = (X1,j+1 - X2,j+1 ) mod 2,147,483,562.
Step 4: Return
Step 5: Set j = j+1, go back to step 2.
• Combined generator has period: (m1 – 1)(m2 – 1)/2 ~ 2 x 1018














0
,
563
2,147,483,
562
2,147,483,
0
,
563
2,147,483,
1
1
1
1
j
j
j
j
X
X
X
R
4.11
Random-Numbers Streams
• The seed for a linear congruential random-number generator:
• Is the integer value X0 that initializes the random-number sequence.
• Any value in the sequence can be used to “seed” the generator.
• A random-number stream:
• Refers to a starting seed taken from the sequence X0, X1, …, XP.
• If the streams are b values apart, then stream i could defined by starting seed:
• Older generators: b = 105; Newer generators: b = 1037.
• A single random-number generator with k streams can act like k distinct
virtual random-number generators
• To compare two or more alternative systems.
• Advantageous to dedicate portions of the pseudo-random number sequence to
the same purpose in each of the simulated systems.
4.12
Thank you

More Related Content

What's hot

Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
MissAnam
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo method
Saurabh Sood
 
Statistical inference
Statistical inferenceStatistical inference
Statistical inference
Jags Jagdish
 
PROBABILITY AND IT'S TYPES WITH RULES
PROBABILITY AND IT'S TYPES WITH RULESPROBABILITY AND IT'S TYPES WITH RULES
PROBABILITY AND IT'S TYPES WITH RULES
Bhargavi Bhanu
 
Chapter 2 part3-Least-Squares Regression
Chapter 2 part3-Least-Squares RegressionChapter 2 part3-Least-Squares Regression
Chapter 2 part3-Least-Squares Regression
nszakir
 
Monte Carlo Simulations
Monte Carlo SimulationsMonte Carlo Simulations
Monte Carlo Simulations
gfbreaux
 
B spline surfeces
B spline surfecesB spline surfeces
B spline surfeces
ramac123
 

What's hot (20)

Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo method
 
Basics of Regression analysis
 Basics of Regression analysis Basics of Regression analysis
Basics of Regression analysis
 
f and t test
f and t testf and t test
f and t test
 
Markov Chain Monte Carlo explained
Markov Chain Monte Carlo explainedMarkov Chain Monte Carlo explained
Markov Chain Monte Carlo explained
 
Midsquare method- simulation system
Midsquare method- simulation systemMidsquare method- simulation system
Midsquare method- simulation system
 
Markov Chain Monte Carlo Methods
Markov Chain Monte Carlo MethodsMarkov Chain Monte Carlo Methods
Markov Chain Monte Carlo Methods
 
Statistical inference
Statistical inferenceStatistical inference
Statistical inference
 
SOME PROPERTIES OF ESTIMATORS - 552.ppt
SOME PROPERTIES OF ESTIMATORS - 552.pptSOME PROPERTIES OF ESTIMATORS - 552.ppt
SOME PROPERTIES OF ESTIMATORS - 552.ppt
 
Probability Distributions
Probability DistributionsProbability Distributions
Probability Distributions
 
PROBABILITY AND IT'S TYPES WITH RULES
PROBABILITY AND IT'S TYPES WITH RULESPROBABILITY AND IT'S TYPES WITH RULES
PROBABILITY AND IT'S TYPES WITH RULES
 
Chapter 2 part3-Least-Squares Regression
Chapter 2 part3-Least-Squares RegressionChapter 2 part3-Least-Squares Regression
Chapter 2 part3-Least-Squares Regression
 
Monte Carlo Simulations
Monte Carlo SimulationsMonte Carlo Simulations
Monte Carlo Simulations
 
48315828 tensor-analysis
48315828 tensor-analysis48315828 tensor-analysis
48315828 tensor-analysis
 
Linear regression analysis
Linear regression analysisLinear regression analysis
Linear regression analysis
 
Non linear curve fitting
Non linear curve fitting Non linear curve fitting
Non linear curve fitting
 
B spline surfeces
B spline surfecesB spline surfeces
B spline surfeces
 
Probability And Its Axioms
Probability And Its AxiomsProbability And Its Axioms
Probability And Its Axioms
 
Correlation and regression analysis
Correlation and regression analysisCorrelation and regression analysis
Correlation and regression analysis
 
Solid modeling-Sweep Representation and B-representation
Solid modeling-Sweep Representation and B-representationSolid modeling-Sweep Representation and B-representation
Solid modeling-Sweep Representation and B-representation
 

Similar to 4. random number and it's generating techniques

Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
PMILebanonChapter
 
Two Pseudo-random Number Generators, an Overview
Two Pseudo-random Number Generators, an Overview Two Pseudo-random Number Generators, an Overview
Two Pseudo-random Number Generators, an Overview
Kato Mivule
 
Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1
asslang
 

Similar to 4. random number and it's generating techniques (20)

Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generation
 
Pseudo Random Number
Pseudo Random NumberPseudo Random Number
Pseudo Random Number
 
06.pdf
06.pdf06.pdf
06.pdf
 
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
 
Ppt
PptPpt
Ppt
 
Different Types of Machine Learning Algorithms
Different Types of Machine Learning AlgorithmsDifferent Types of Machine Learning Algorithms
Different Types of Machine Learning Algorithms
 
microprocessor
microprocessormicroprocessor
microprocessor
 
Random Number Generator.pdf
Random Number Generator.pdfRandom Number Generator.pdf
Random Number Generator.pdf
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
Response surface methodology.pptx
Response surface methodology.pptxResponse surface methodology.pptx
Response surface methodology.pptx
 
A framework for practical fast matrix multiplication
A framework for practical fast matrix multiplication�A framework for practical fast matrix multiplication�
A framework for practical fast matrix multiplication
 
Shor’s algorithm the ppt
Shor’s algorithm the pptShor’s algorithm the ppt
Shor’s algorithm the ppt
 
Two Pseudo-random Number Generators, an Overview
Two Pseudo-random Number Generators, an Overview Two Pseudo-random Number Generators, an Overview
Two Pseudo-random Number Generators, an Overview
 
A comprehensive study on Applications of Vedic Multipliers in signal processing
A comprehensive study on Applications of Vedic Multipliers in signal processingA comprehensive study on Applications of Vedic Multipliers in signal processing
A comprehensive study on Applications of Vedic Multipliers in signal processing
 
Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1
 
Number Systems and Binary Aritmetics
Number Systems and Binary AritmeticsNumber Systems and Binary Aritmetics
Number Systems and Binary Aritmetics
 
Moving Toward Deep Learning Algorithms on HPCC Systems
Moving Toward Deep Learning Algorithms on HPCC SystemsMoving Toward Deep Learning Algorithms on HPCC Systems
Moving Toward Deep Learning Algorithms on HPCC Systems
 
Javascript.ppt
Javascript.pptJavascript.ppt
Javascript.ppt
 
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
 

More from MdFazleRabbi18

Topic4 data encryption standard(des)
Topic4 data encryption standard(des)Topic4 data encryption standard(des)
Topic4 data encryption standard(des)
MdFazleRabbi18
 

More from MdFazleRabbi18 (20)

5.programmable interval timer 8253
5.programmable interval timer 82535.programmable interval timer 8253
5.programmable interval timer 8253
 
4.programmable dma controller 8257
4.programmable dma controller 82574.programmable dma controller 8257
4.programmable dma controller 8257
 
3.programmable interrupt controller 8259
3.programmable interrupt controller 82593.programmable interrupt controller 8259
3.programmable interrupt controller 8259
 
1.ppi 8255
1.ppi 8255 1.ppi 8255
1.ppi 8255
 
Topic4 data encryption standard(des)
Topic4 data encryption standard(des)Topic4 data encryption standard(des)
Topic4 data encryption standard(des)
 
Topic3 playfain
Topic3 playfainTopic3 playfain
Topic3 playfain
 
Topic2 caser hill_cripto
Topic2 caser hill_criptoTopic2 caser hill_cripto
Topic2 caser hill_cripto
 
Topic5 advanced encryption standard (aes)
Topic5 advanced encryption standard (aes)Topic5 advanced encryption standard (aes)
Topic5 advanced encryption standard (aes)
 
Topic1 substitution transposition-techniques
Topic1 substitution transposition-techniquesTopic1 substitution transposition-techniques
Topic1 substitution transposition-techniques
 
11. lzw coding
11. lzw coding11. lzw coding
11. lzw coding
 
9. hofman coding in DIP
9. hofman coding in DIP9. hofman coding in DIP
9. hofman coding in DIP
 
7. image enhancement using spatial filtering
7. image enhancement using spatial filtering7. image enhancement using spatial filtering
7. image enhancement using spatial filtering
 
5. gray level transformation
5. gray level transformation5. gray level transformation
5. gray level transformation
 
1. steps in image processing
1. steps in image processing1. steps in image processing
1. steps in image processing
 
5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals 5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals
 
4. operations of signals
4. operations of signals 4. operations of signals
4. operations of signals
 
3. systems
3. systems 3. systems
3. systems
 
2. classification of signals
2. classification of signals 2. classification of signals
2. classification of signals
 
1. elementary signals
1. elementary signals 1. elementary signals
1. elementary signals
 
3. different types of simulations for appropriate systems
3. different types of simulations for appropriate systems 3. different types of simulations for appropriate systems
3. different types of simulations for appropriate systems
 

Recently uploaded

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
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
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(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
 
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
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
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
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
(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
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 

4. random number and it's generating techniques

  • 1. Random number and It's generating techniques By Md. Fazle Rabbi 16CSE057
  • 2. 4.2 Random numbers What is random numbers ? • A random number is a number generated by a process, • Whose outcome is unpredictable. • And which cannot be sub sequentially reproduced. Random number plays important role in simulation task
  • 3. 4.3 Properties of random numbers The main properties of random numbers are • Uniformity They are equally possible every where • Independence The current value of a random variable has no relation with the previous value
  • 4. 4.4 Generation of Pseudo-Random Numbers • “Pseudo”, because generating numbers using a known method removes the potential for true randomness. • Goal: To produce a sequence of numbers in [0,1] that simulates, or imitates, the ideal properties of random numbers (RN). • Important considerations in RN routines: • Fast • Portable to different computers • Have sufficiently long cycle • Replicable • Closely approximate the ideal statistical properties of uniformity and independence.
  • 5. 4.5 Techniques for Generating Random Numbers • Linear Congruential Method (LCM). • Combined Linear Congruential Generators (CLCG). • Random-Number Streams.
  • 6. 4.6 Linear congruential method Proposed by Lehmer, produces a sequences of integer numbers X1 ,X2 , … between zero and m-1 by following the recursive relationship: X i+1= (aXi+c) mod m, i=0,1,2,3… • The initial value i.e. x0 is called seed • a is called multiplier • c is called the increment • m is called the modulus • If c ≠ 𝟎 then form is called mixed congruential method • When c=0, the form is called multiplicative congruential method ,... 2 , 1 ,   i m X R i i
  • 7. 4.7 Example [LCM] • Use X0 = 27, a = 17, c = 43, and m = 100. • The Xi and Ri values are: X1 = (17*27+43) mod 100 = 502 mod 100 = 2, R1 = 0.02; X2 = (17*2+43) mod 100 = 77, R2 = 0.77; X3 = (17*77+43) mod 100 = 52, R3 = 0.52;
  • 8. 4.8 Combined linear congruential generators • Reason: Longer period generator is needed because of the increasing complexity of stimulated systems. • Approach: Combine two or more multiplicative congruential generators. • Let Xi,1, Xi,2, …, Xi,k, be the ith output from k different multiplicative congruential generators. • The jth generator: • Has prime modulus mj and multiplier aj and period is mj-1 • Produces integers Xi,j is approx ~ Uniform on integers in [1, m-1] • Wi,j = Xi,j -1 is approx ~ Uniform on integers in [1, m-2]
  • 9. 4.9 Combined linear congruential generators • Suggested form: • The maximum possible period is: 1 mod ) 1 ( 1 1 , 1               m X X k j j i j i           0 , 1 0 , Hence, 1 1 1 i i i i X m m X m X R  1 2 1 2 ) 1 )...( 1 )( 1 (      k k m m m P The coefficient: Performs the subtraction Xi,1-1
  • 10. 4.10 Combined linear congruential generators • Example: For 32-bit computers, L’Ecuyer [1988] suggests combining k = 2 generators with m1 = 2,147,483,563, a1 = 40,014, m2 = 2,147,483,399 and a2 = 20,692. The algorithm becomes: Step 1: Select seeds • X1,0 in the range [1, 2,147,483,562] for the 1st generator • X2,0 in the range [1, 2,147,483,398] for the 2nd generator. Step 2: For each individual generator, X1,j+1 = 40,014 X1,j mod 2,147,483,563 X2,j+1 = 40,692 X1,j mod 2,147,483,399. Step 3: Xj+1 = (X1,j+1 - X2,j+1 ) mod 2,147,483,562. Step 4: Return Step 5: Set j = j+1, go back to step 2. • Combined generator has period: (m1 – 1)(m2 – 1)/2 ~ 2 x 1018               0 , 563 2,147,483, 562 2,147,483, 0 , 563 2,147,483, 1 1 1 1 j j j j X X X R
  • 11. 4.11 Random-Numbers Streams • The seed for a linear congruential random-number generator: • Is the integer value X0 that initializes the random-number sequence. • Any value in the sequence can be used to “seed” the generator. • A random-number stream: • Refers to a starting seed taken from the sequence X0, X1, …, XP. • If the streams are b values apart, then stream i could defined by starting seed: • Older generators: b = 105; Newer generators: b = 1037. • A single random-number generator with k streams can act like k distinct virtual random-number generators • To compare two or more alternative systems. • Advantageous to dedicate portions of the pseudo-random number sequence to the same purpose in each of the simulated systems.