SlideShare a Scribd company logo
1 of 17
Download to read offline
RANDOM NUMBER GENERATORS
(PEMBANGKIT BILANGAN RANDOM)
TEKNIK SIMULASI 2017
DEPARTEMEN STATISTIKA - ITS
• Random number yang digunakan dalam simulasi adalah Random
number yang berbasis pada bilangan kontinyu antara 0 sampai 1,
dimana peluang untuk terpilihnya suatu bilangan adalah sama.
• Dalam teori distribusi probabilitas, hal tersebut dapat ditemukan
pada distribusi uniform dengan a=0 dan b=1.
• Uniform (0,1) ini akan digunakan sebagai GENERATOR UTAMA dalam
membangkitkan bilangan random yang berdistribusi selain U(0,1).
Random number generators
Random number generators
A ‘good’ random-number generator should satisfy the following properties:
• Uniformity: The numbers generated appear to be distributed uniformly on
(0, 1)
• Independence: The numbers generated show no correlation with each
other
• Replication: The numbers should be replicable (e.g., for debugging or
comparison of different systems)
• Cycle length: It should take long before numbers start to repeat
• Speed: The generator should be fast
• Memory usage: The generator should not require a lot of storage.
Uniform distribution (0,1)
0 1
1
f(x)
1 , 0 1
( )
0 , lainnya
x
f x
 

 

x
5
X(i) X(i-1) "=CORREL(B3:B12,C3:C12)"
0.138361 *
0.524032 0.138361
0.81719 0.524032
0.836617 0.81719
0.889346 0.836617
0.008127 0.889346
0.481535 0.008127
0.479609 0.481535
0.342851 0.479609
0.346023 0.342851
Correlation with lag-1
Random number generators
Most random-number generators are of the form:
• Start with 𝑧0 (seed)
• For n=1,2, … generate:
𝑧𝑛 = 𝑓(𝑧𝑛−1)
and
𝑢𝑛 = 𝑔(𝑧𝑛)
f is the pseudo-random generator
g is the output function
{𝑢0, 𝑢1, … } is the sequence of uniform random numbers on the interval (0,1)
RNG methods
• Middle square
• Linear congruential generator
Middle square
STEPS:
• Start with a 4-digit number 𝑧0 (seed)
• Square it to obtain 8-digits (𝑧0
2
) (if necessary, append zeros to the left)
• Take the middle 4 digits of 𝑧0
2
to obtain the next 4-digit number 𝑧1
• We get uniform random (𝑢1)number by placing the decimal point at
the left of each 𝑧1 (i.e., divide by 10000)
• And so on.
Example
9
i Zi Ui (Zi)2
0 7182 - 51581124
1 5811 0.5811 33767721
2 7677 0.7677 58936329
3 9363 0.9363 87665767
Practical way
Supaya nilai U antara 0 dan 1, maka:
nilai maksimalsesuai digit
i
i
Z
U 
Misalkan digit=2, maka nilai maksimalnya 99
Misalkan digit=3, maka nilai maksimalnya 999
Misalkan digit=4, maka nilai maksimalnya 9999
dst
In Excel
Linear congruential generators
• Most random-number generators in use today are linear congruential
generators.
• They produce a sequence of integers between 0 and m-1 according
to:
a is the multiplier (0 < a < m), c the increment (0 <= c < m) and m the
modulus (m > 0), with Z0 is seed or starting value (0 <= Z0 < m)
• To obtain uniform random numbers on (0,1) we take
• A good choice of a, c and m is very important.
1
( ) mod
n n
x ax c m

 
𝑢𝑛 =
𝑧𝑛
𝑚
Linear congruential generators
Example:
• For (a, c, m) = (1, 5, 13) and x0 = 1 we get the sequence x1, …, xn are
1, 6, 11, 3, 8, 0, 5, 10, 2, 7, 12, 4, 9, 1, … which has full period (of 13).
• For (a, c, m) = (2, 5, 13) and x0=1 we get the sequence x1, …, xn are 1,
7, 6, 4, 0, 5, 2, 9, 10, 12, 3, 11, 1, … which has a period of 12. If we
take x0 = 8, we get the sequence 8, 8, 8, … (period of 1).
When c > 0.
Guidance to choose a, c, m, X0 :
• Nilai konstanta a > akar m
• Konstanta c harus berangka ganjil apabila m bernilai
pangkat dua. Nilai c bukan kelipatan m
• Modulo m adalah bilangan prima.
• Nilai x0 bernilai integer, ganjil , dan besar
Additive congruential generator
Multiplicative congruential generator
These generators produce a sequence of integers between 0 and m-1
according to:
𝑥𝑛= a𝑥𝑛−1 mod 𝑚
So they are linear congruential generators with c = 0.
They cannot have full period, but it is possible to obtain period m-1 (so
each integer 1, ..., m-1 is obtained exactly once in each cycle) if a and m
are chosen carefully.
Guidance to choose a, m, x0 :
• Nilai a adalah bilangan prima.
• Nilai m adalah integer dan besar.
• Nilai x0 (disebut seed) integer, ganjil, dan besar
Multiplicative congruential generator
Demo in Excel

More Related Content

Similar to Random Number Generator.pdf

1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docx
1 Lab 4   The Central Limit Theorem and A Monte Carlo Si.docx1 Lab 4   The Central Limit Theorem and A Monte Carlo Si.docx
1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docxjeremylockett77
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraMUHAMMADUSMAN93058
 
MT6702 Unit 2 Random Number Generation
MT6702 Unit 2 Random Number GenerationMT6702 Unit 2 Random Number Generation
MT6702 Unit 2 Random Number GenerationKannappan Subramaniam
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxSunny432360
 
Testing Numbers for Randomness Chi Square test
Testing Numbers for Randomness Chi Square testTesting Numbers for Randomness Chi Square test
Testing Numbers for Randomness Chi Square testRachitSharma6516
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................nourhandardeer3
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsKrishnan MuthuManickam
 
Essentials of monte carlo simulation
Essentials of monte carlo simulationEssentials of monte carlo simulation
Essentials of monte carlo simulationSpringer
 
Equations and tilings
Equations and tilingsEquations and tilings
Equations and tilingsnavajomath
 
EMOD_Optimization_Presentation.pptx
EMOD_Optimization_Presentation.pptxEMOD_Optimization_Presentation.pptx
EMOD_Optimization_Presentation.pptxAliElMoselhy
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionMubashir Ali
 
An Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonAn Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonKasun Ranga Wijeweera
 

Similar to Random Number Generator.pdf (20)

1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docx
1 Lab 4   The Central Limit Theorem and A Monte Carlo Si.docx1 Lab 4   The Central Limit Theorem and A Monte Carlo Si.docx
1 Lab 4 The Central Limit Theorem and A Monte Carlo Si.docx
 
Pattern Discovery - part I
Pattern Discovery - part IPattern Discovery - part I
Pattern Discovery - part I
 
Talk 2
Talk 2Talk 2
Talk 2
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear Algebra
 
06.pdf
06.pdf06.pdf
06.pdf
 
MT6702 Unit 2 Random Number Generation
MT6702 Unit 2 Random Number GenerationMT6702 Unit 2 Random Number Generation
MT6702 Unit 2 Random Number Generation
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptx
 
Pseudo Random Number
Pseudo Random NumberPseudo Random Number
Pseudo Random Number
 
Testing Numbers for Randomness Chi Square test
Testing Numbers for Randomness Chi Square testTesting Numbers for Randomness Chi Square test
Testing Numbers for Randomness Chi Square test
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Lec 06
Lec 06Lec 06
Lec 06
 
Essentials of monte carlo simulation
Essentials of monte carlo simulationEssentials of monte carlo simulation
Essentials of monte carlo simulation
 
Equations and tilings
Equations and tilingsEquations and tilings
Equations and tilings
 
Matlab tutorial 2
Matlab tutorial 2Matlab tutorial 2
Matlab tutorial 2
 
EMOD_Optimization_Presentation.pptx
EMOD_Optimization_Presentation.pptxEMOD_Optimization_Presentation.pptx
EMOD_Optimization_Presentation.pptx
 
Lecture-2(2): Number System & Conversion
Lecture-2(2): Number System & ConversionLecture-2(2): Number System & Conversion
Lecture-2(2): Number System & Conversion
 
Ppt
PptPpt
Ppt
 
An Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonAn Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a Polygon
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

Random Number Generator.pdf

  • 1. RANDOM NUMBER GENERATORS (PEMBANGKIT BILANGAN RANDOM) TEKNIK SIMULASI 2017 DEPARTEMEN STATISTIKA - ITS
  • 2. • Random number yang digunakan dalam simulasi adalah Random number yang berbasis pada bilangan kontinyu antara 0 sampai 1, dimana peluang untuk terpilihnya suatu bilangan adalah sama. • Dalam teori distribusi probabilitas, hal tersebut dapat ditemukan pada distribusi uniform dengan a=0 dan b=1. • Uniform (0,1) ini akan digunakan sebagai GENERATOR UTAMA dalam membangkitkan bilangan random yang berdistribusi selain U(0,1). Random number generators
  • 3. Random number generators A ‘good’ random-number generator should satisfy the following properties: • Uniformity: The numbers generated appear to be distributed uniformly on (0, 1) • Independence: The numbers generated show no correlation with each other • Replication: The numbers should be replicable (e.g., for debugging or comparison of different systems) • Cycle length: It should take long before numbers start to repeat • Speed: The generator should be fast • Memory usage: The generator should not require a lot of storage.
  • 4. Uniform distribution (0,1) 0 1 1 f(x) 1 , 0 1 ( ) 0 , lainnya x f x       x
  • 5. 5 X(i) X(i-1) "=CORREL(B3:B12,C3:C12)" 0.138361 * 0.524032 0.138361 0.81719 0.524032 0.836617 0.81719 0.889346 0.836617 0.008127 0.889346 0.481535 0.008127 0.479609 0.481535 0.342851 0.479609 0.346023 0.342851 Correlation with lag-1
  • 6. Random number generators Most random-number generators are of the form: • Start with 𝑧0 (seed) • For n=1,2, … generate: 𝑧𝑛 = 𝑓(𝑧𝑛−1) and 𝑢𝑛 = 𝑔(𝑧𝑛) f is the pseudo-random generator g is the output function {𝑢0, 𝑢1, … } is the sequence of uniform random numbers on the interval (0,1)
  • 7. RNG methods • Middle square • Linear congruential generator
  • 8. Middle square STEPS: • Start with a 4-digit number 𝑧0 (seed) • Square it to obtain 8-digits (𝑧0 2 ) (if necessary, append zeros to the left) • Take the middle 4 digits of 𝑧0 2 to obtain the next 4-digit number 𝑧1 • We get uniform random (𝑢1)number by placing the decimal point at the left of each 𝑧1 (i.e., divide by 10000) • And so on.
  • 9. Example 9 i Zi Ui (Zi)2 0 7182 - 51581124 1 5811 0.5811 33767721 2 7677 0.7677 58936329 3 9363 0.9363 87665767
  • 10. Practical way Supaya nilai U antara 0 dan 1, maka: nilai maksimalsesuai digit i i Z U  Misalkan digit=2, maka nilai maksimalnya 99 Misalkan digit=3, maka nilai maksimalnya 999 Misalkan digit=4, maka nilai maksimalnya 9999 dst
  • 12. Linear congruential generators • Most random-number generators in use today are linear congruential generators. • They produce a sequence of integers between 0 and m-1 according to: a is the multiplier (0 < a < m), c the increment (0 <= c < m) and m the modulus (m > 0), with Z0 is seed or starting value (0 <= Z0 < m) • To obtain uniform random numbers on (0,1) we take • A good choice of a, c and m is very important. 1 ( ) mod n n x ax c m    𝑢𝑛 = 𝑧𝑛 𝑚
  • 13. Linear congruential generators Example: • For (a, c, m) = (1, 5, 13) and x0 = 1 we get the sequence x1, …, xn are 1, 6, 11, 3, 8, 0, 5, 10, 2, 7, 12, 4, 9, 1, … which has full period (of 13). • For (a, c, m) = (2, 5, 13) and x0=1 we get the sequence x1, …, xn are 1, 7, 6, 4, 0, 5, 2, 9, 10, 12, 3, 11, 1, … which has a period of 12. If we take x0 = 8, we get the sequence 8, 8, 8, … (period of 1).
  • 14. When c > 0. Guidance to choose a, c, m, X0 : • Nilai konstanta a > akar m • Konstanta c harus berangka ganjil apabila m bernilai pangkat dua. Nilai c bukan kelipatan m • Modulo m adalah bilangan prima. • Nilai x0 bernilai integer, ganjil , dan besar Additive congruential generator
  • 15. Multiplicative congruential generator These generators produce a sequence of integers between 0 and m-1 according to: 𝑥𝑛= a𝑥𝑛−1 mod 𝑚 So they are linear congruential generators with c = 0. They cannot have full period, but it is possible to obtain period m-1 (so each integer 1, ..., m-1 is obtained exactly once in each cycle) if a and m are chosen carefully.
  • 16. Guidance to choose a, m, x0 : • Nilai a adalah bilangan prima. • Nilai m adalah integer dan besar. • Nilai x0 (disebut seed) integer, ganjil, dan besar Multiplicative congruential generator