SlideShare una empresa de Scribd logo
1 de 3
By: Kishoj Bajracharya (062-BCT-515)

Q. No: 1) Use the linear congruential method to generate the sequence of three two-digit random
integers assuming Xo=27, a=8, c=47 and m=100.

Solution:

Given, Xo = 27,         a = 8,          c = 47,        m = 100

Using formula, Xi = (a * Xi-1 + c) mod(m)

        X1 = (8 * 27 + 47) mod (100) = 263 mod (100) = 2.63

        Quotient = 2;   Remainder or Residue = 63

        X1 = Residue = 63;

        X2 = (8 * 63 + 47) mod (100) = 551 mod (100) = 5.51

        Quotient = 5;   Remainder or Residue = 51

        X2 = Residue = 51;

        X3 = (8 * 51 + 47) mod (100) = 455 mod (100) = 4.55

        Quotient = 4;   Remainder or Residue = 55

        X = (27 63 51 55)

The three two-digit random integers we are looking for are 63, 51 and 55.



Q. No: 2) Use the multiplicative congruential method to generate the four three-digit random integers
assuming Xo=117, a=43, and m=1000.

Solution:

Given, Xo = 117,        a =43,          m = 1000

Using formula, Xi = (a * Xi-1) mod(m)

        X1 = (43 * 117) mod (1000) = 5031 mod (1000) = 5.031

        Quotient = 5;   Remainder or Residue = 31 (2-digit)

        X1 = Residue = 31;

        X2 = (43 * 31) mod (1000) = 1333 mod (1000) = 1.333

        Quotient = 1;   Remainder or Residue = 333 (First 3-digit Random Number)
By: Kishoj Bajracharya (062-BCT-515)

        X2 = Residue = 333;

        X3 = (43 * 333) mod (1000) = 14319 mod (1000) = 14.319

        Quotient = 14; Remainder or Residue = 319 (Second 3-digit Random Number)

        X3 = Residue = 319;

        X4 = (43 * 319) mod (1000) = 13717 mod (1000) = 13.717

        Quotient = 13; Remainder or Residue = 717 (Third 3-digit Random Number)

        X4 = Residue = 717;

        X5 = (43 * 717) mod (1000) = 30831 mod (1000) = 30.831

        Quotient = 30; Remainder or Residue = 831 (Fourth 3-digit Random Number)

        X = (117 31 333 319 717 831)

The four three-digit random integers we are looking for are 333, 319, 717 and 831.




Q. No: 3) Use the mixed congruential method to generate a sequence of three two-digit random
numbers with Xo=37, a=7, c=29 and m=100.

Solution:

Given, Xo = 37,         a = 7,          c = 29,        m = 100

Using formula, Xi = (a * Xi-1 + c) mod(m)

        X1 = (7 * 37 + 29) mod (100) = 288 mod (100) = 2.88

        Quotient = 2;   Remainder or Residue = 88

        X1 = Residue = 88;

        X2 = (7 * 88 + 29) mod (100) = 645 mod (100) = 6.45

        Quotient = 6;   Remainder or Residue = 45

        X2 = Residue = 45;

        X3 = (7 * 45 + 29) mod (100) = 344 mod (100) = 3.44

        Quotient = 3;   Remainder or Residue = 44
By: Kishoj Bajracharya (062-BCT-515)

       X = (37 88 45 44)

The 3 two-digit random numbers we are looking for are 88, 45, and 44.

Más contenido relacionado

La actualidad más candente

Lecture 06 production system
Lecture 06 production systemLecture 06 production system
Lecture 06 production systemHema Kashyap
 
Post-optimal analysis of LPP
Post-optimal analysis of LPPPost-optimal analysis of LPP
Post-optimal analysis of LPPRAVI PRASAD K.J.
 
Monkey & banana problem in AI
Monkey & banana problem in AIMonkey & banana problem in AI
Monkey & banana problem in AIManjeet Kamboj
 
Computer organisation -morris mano
Computer organisation  -morris manoComputer organisation  -morris mano
Computer organisation -morris manovishnu murthy
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSvtunotesbysree
 
Chp. 2 simulation examples
Chp. 2 simulation examplesChp. 2 simulation examples
Chp. 2 simulation examplesPravesh Negi
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And SubtractionKeyur Vadodariya
 
Discrete Event Simulation.ppt
Discrete Event Simulation.pptDiscrete Event Simulation.ppt
Discrete Event Simulation.pptvinukorekar
 
Fuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningFuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningVeni7
 
Answers computer networks 159334 assignment_2_2010
Answers computer networks 159334 assignment_2_2010Answers computer networks 159334 assignment_2_2010
Answers computer networks 159334 assignment_2_2010Lakshmi Gupta
 
Random number generation
Random number generationRandom number generation
Random number generationvinay126me
 
Discrete event simulation
Discrete event simulationDiscrete event simulation
Discrete event simulationssusera970cc
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 

La actualidad más candente (20)

predicate logic example
predicate logic examplepredicate logic example
predicate logic example
 
Lecture 06 production system
Lecture 06 production systemLecture 06 production system
Lecture 06 production system
 
Post-optimal analysis of LPP
Post-optimal analysis of LPPPost-optimal analysis of LPP
Post-optimal analysis of LPP
 
Monkey & banana problem in AI
Monkey & banana problem in AIMonkey & banana problem in AI
Monkey & banana problem in AI
 
Computer organisation -morris mano
Computer organisation  -morris manoComputer organisation  -morris mano
Computer organisation -morris mano
 
Mutual exclusion
Mutual exclusionMutual exclusion
Mutual exclusion
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
 
Chp. 2 simulation examples
Chp. 2 simulation examplesChp. 2 simulation examples
Chp. 2 simulation examples
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And Subtraction
 
Compiler lec 8
Compiler lec 8Compiler lec 8
Compiler lec 8
 
Amdahl`s law -Processor performance
Amdahl`s law -Processor performanceAmdahl`s law -Processor performance
Amdahl`s law -Processor performance
 
Discrete Event Simulation.ppt
Discrete Event Simulation.pptDiscrete Event Simulation.ppt
Discrete Event Simulation.ppt
 
Fuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningFuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoning
 
Answers computer networks 159334 assignment_2_2010
Answers computer networks 159334 assignment_2_2010Answers computer networks 159334 assignment_2_2010
Answers computer networks 159334 assignment_2_2010
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Distributed Systems Naming
Distributed Systems NamingDistributed Systems Naming
Distributed Systems Naming
 
Random number generation
Random number generationRandom number generation
Random number generation
 
Discrete event simulation
Discrete event simulationDiscrete event simulation
Discrete event simulation
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 

Similar a Random Number Generation

Digital textbook -EXPONENTS AND POWERS
Digital textbook -EXPONENTS AND POWERSDigital textbook -EXPONENTS AND POWERS
Digital textbook -EXPONENTS AND POWERSGANESHKRISHNANG
 
From moments to sparse representations, a geometric, algebraic and algorithmi...
From moments to sparse representations, a geometric, algebraic and algorithmi...From moments to sparse representations, a geometric, algebraic and algorithmi...
From moments to sparse representations, a geometric, algebraic and algorithmi...BernardMourrain
 
Straight-Line-Graphs-Final -2.pptx
Straight-Line-Graphs-Final -2.pptxStraight-Line-Graphs-Final -2.pptx
Straight-Line-Graphs-Final -2.pptxKviskvis
 
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01Mahadeva K S
 
6 polynomial expressions and operations
6 polynomial expressions and operations6 polynomial expressions and operations
6 polynomial expressions and operationselem-alg-sample
 
46polynomial expressions
46polynomial expressions46polynomial expressions
46polynomial expressionsalg1testreview
 
Statistics assignment 2
Statistics assignment 2Statistics assignment 2
Statistics assignment 2Ishaq Ahmed
 
Module 2 exponential functions
Module 2   exponential functionsModule 2   exponential functions
Module 2 exponential functionsdionesioable
 
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsx
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsxClass-10-Mathematics-Chapter-1-CBSE-NCERT.ppsx
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsxSoftcare Solution
 
RS Agarwal Quantitative Aptitude - 7 chap
RS Agarwal Quantitative Aptitude - 7 chapRS Agarwal Quantitative Aptitude - 7 chap
RS Agarwal Quantitative Aptitude - 7 chapVinoth Kumar.K
 
algebra lesson notes (best).pdf
algebra lesson notes (best).pdfalgebra lesson notes (best).pdf
algebra lesson notes (best).pdfCyprianObota
 
101 math short cuts [www.onlinebcs.com]
101 math short cuts [www.onlinebcs.com]101 math short cuts [www.onlinebcs.com]
101 math short cuts [www.onlinebcs.com]Itmona
 

Similar a Random Number Generation (20)

Digital textbook -EXPONENTS AND POWERS
Digital textbook -EXPONENTS AND POWERSDigital textbook -EXPONENTS AND POWERS
Digital textbook -EXPONENTS AND POWERS
 
From moments to sparse representations, a geometric, algebraic and algorithmi...
From moments to sparse representations, a geometric, algebraic and algorithmi...From moments to sparse representations, a geometric, algebraic and algorithmi...
From moments to sparse representations, a geometric, algebraic and algorithmi...
 
Guess paper x
Guess paper xGuess paper x
Guess paper x
 
Smart solution
Smart solutionSmart solution
Smart solution
 
Straight-Line-Graphs-Final -2.pptx
Straight-Line-Graphs-Final -2.pptxStraight-Line-Graphs-Final -2.pptx
Straight-Line-Graphs-Final -2.pptx
 
Laws of Exponent
Laws of ExponentLaws of Exponent
Laws of Exponent
 
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01
Ipuc annualexamqpaperforyear2013-2014-140113114635-phpapp01
 
7. problem on numbers
7. problem on numbers7. problem on numbers
7. problem on numbers
 
6 polynomial expressions and operations
6 polynomial expressions and operations6 polynomial expressions and operations
6 polynomial expressions and operations
 
46polynomial expressions
46polynomial expressions46polynomial expressions
46polynomial expressions
 
Statistics assignment 2
Statistics assignment 2Statistics assignment 2
Statistics assignment 2
 
Linear eqn
Linear eqnLinear eqn
Linear eqn
 
Xii hy r
Xii hy rXii hy r
Xii hy r
 
Module 2 exponential functions
Module 2   exponential functionsModule 2   exponential functions
Module 2 exponential functions
 
7 chap
7 chap7 chap
7 chap
 
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsx
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsxClass-10-Mathematics-Chapter-1-CBSE-NCERT.ppsx
Class-10-Mathematics-Chapter-1-CBSE-NCERT.ppsx
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
RS Agarwal Quantitative Aptitude - 7 chap
RS Agarwal Quantitative Aptitude - 7 chapRS Agarwal Quantitative Aptitude - 7 chap
RS Agarwal Quantitative Aptitude - 7 chap
 
algebra lesson notes (best).pdf
algebra lesson notes (best).pdfalgebra lesson notes (best).pdf
algebra lesson notes (best).pdf
 
101 math short cuts [www.onlinebcs.com]
101 math short cuts [www.onlinebcs.com]101 math short cuts [www.onlinebcs.com]
101 math short cuts [www.onlinebcs.com]
 

Más de Kishoj Bajracharya (8)

Tutorial for RDF Graphs
Tutorial for RDF GraphsTutorial for RDF Graphs
Tutorial for RDF Graphs
 
Comparison of Agent-based platforms
Comparison of Agent-based platformsComparison of Agent-based platforms
Comparison of Agent-based platforms
 
IPv6 examples
IPv6 examplesIPv6 examples
IPv6 examples
 
Network Coding
Network CodingNetwork Coding
Network Coding
 
Galios: Python Programming
Galios: Python Programming Galios: Python Programming
Galios: Python Programming
 
OLSR setup
OLSR setup OLSR setup
OLSR setup
 
DBpedia mobile
DBpedia mobileDBpedia mobile
DBpedia mobile
 
Manual orange
Manual orangeManual orange
Manual orange
 

Último

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Último (20)

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Random Number Generation

  • 1. By: Kishoj Bajracharya (062-BCT-515) Q. No: 1) Use the linear congruential method to generate the sequence of three two-digit random integers assuming Xo=27, a=8, c=47 and m=100. Solution: Given, Xo = 27, a = 8, c = 47, m = 100 Using formula, Xi = (a * Xi-1 + c) mod(m) X1 = (8 * 27 + 47) mod (100) = 263 mod (100) = 2.63 Quotient = 2; Remainder or Residue = 63 X1 = Residue = 63; X2 = (8 * 63 + 47) mod (100) = 551 mod (100) = 5.51 Quotient = 5; Remainder or Residue = 51 X2 = Residue = 51; X3 = (8 * 51 + 47) mod (100) = 455 mod (100) = 4.55 Quotient = 4; Remainder or Residue = 55 X = (27 63 51 55) The three two-digit random integers we are looking for are 63, 51 and 55. Q. No: 2) Use the multiplicative congruential method to generate the four three-digit random integers assuming Xo=117, a=43, and m=1000. Solution: Given, Xo = 117, a =43, m = 1000 Using formula, Xi = (a * Xi-1) mod(m) X1 = (43 * 117) mod (1000) = 5031 mod (1000) = 5.031 Quotient = 5; Remainder or Residue = 31 (2-digit) X1 = Residue = 31; X2 = (43 * 31) mod (1000) = 1333 mod (1000) = 1.333 Quotient = 1; Remainder or Residue = 333 (First 3-digit Random Number)
  • 2. By: Kishoj Bajracharya (062-BCT-515) X2 = Residue = 333; X3 = (43 * 333) mod (1000) = 14319 mod (1000) = 14.319 Quotient = 14; Remainder or Residue = 319 (Second 3-digit Random Number) X3 = Residue = 319; X4 = (43 * 319) mod (1000) = 13717 mod (1000) = 13.717 Quotient = 13; Remainder or Residue = 717 (Third 3-digit Random Number) X4 = Residue = 717; X5 = (43 * 717) mod (1000) = 30831 mod (1000) = 30.831 Quotient = 30; Remainder or Residue = 831 (Fourth 3-digit Random Number) X = (117 31 333 319 717 831) The four three-digit random integers we are looking for are 333, 319, 717 and 831. Q. No: 3) Use the mixed congruential method to generate a sequence of three two-digit random numbers with Xo=37, a=7, c=29 and m=100. Solution: Given, Xo = 37, a = 7, c = 29, m = 100 Using formula, Xi = (a * Xi-1 + c) mod(m) X1 = (7 * 37 + 29) mod (100) = 288 mod (100) = 2.88 Quotient = 2; Remainder or Residue = 88 X1 = Residue = 88; X2 = (7 * 88 + 29) mod (100) = 645 mod (100) = 6.45 Quotient = 6; Remainder or Residue = 45 X2 = Residue = 45; X3 = (7 * 45 + 29) mod (100) = 344 mod (100) = 3.44 Quotient = 3; Remainder or Residue = 44
  • 3. By: Kishoj Bajracharya (062-BCT-515) X = (37 88 45 44) The 3 two-digit random numbers we are looking for are 88, 45, and 44.