SlideShare a Scribd company logo
Generate and Test Random NumbersEng. MshariAlabdulkarim
Generate and Test Random NumbersGenerate and Test Random NumbersRandom Number Generation
Generate and Test Random NumbersGenerate and Test Random NumbersTypes of Random-number Generators:Combined generators.
Inversive Generators.Generate and Test Random NumbersGenerate and Test Random NumbersWhen to use Combined Generators :In the simulation of a highly reliable systems, where we need to simulate a huge number of events to observe any error.
In the simulation of a complex networks, where there are a huge number of users running lots of programs.Generate and Test Random NumbersGenerate and Test Random NumbersCombined Linear CongruentialGenerators :In 1988, L’Ecuyer suggested a new way to generate a sequence numbers with a very long period, and that by combining two or more congruential generators.
If Wi,1, Wi,2,..., Wi,kare independent, discrete-valued random variables, and Wi,1 is uniformly distributed between 0 and m1 – 2, then:    is also uniformly distributed between 0 and m1 – 2.
Generate and Test Random NumbersGenerate and Test Random NumbersCombined Linear Congruential Generators (Cont):L’Ecuyer suggested to combined generator of the form:With:The maximum possible period will be:
Generate and Test Random NumbersGenerate and Test Random NumbersExample:Two generators “k = 2”, a1 = 40014, m1 = 2147483563, a2 = 40692, m2 = 2147483399.Algorithm:Choose two seeds, X1,0 from [1, 2147483562] and X2,0 from [1, 2147483398], Set j = 0.Calculate the values from the two generators: Then calculate:After that return:Finally:                             j = j + 1, and then go back to step number 2.
Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):Period:
Generate and Test Random NumbersGenerate and Test Random NumbersInversiveCongruential Generator :Invarsivecongruential generators are a type of nonlinear congruential pseudorandom number generator.
 The standard formula for an inversivecongruential generator is:Generate and Test Random NumbersGenerate and Test Random NumbersTesting Random Number
Generate and Test Random NumbersGenerate and Test Random NumbersTypes of Random-number Testors:Kolmogorov-Smirnov Test.
 Runs Tests.Generate and Test Random NumbersGenerate and Test Random NumbersKolmogorov-Smirnov Test :Developed by A. N. Kolmogorov and N. V. Smirnov.
Designed for continuous distributions.
Difference between the observed CDF (cumulative distribution function) Fo(x) and the expected cdf Fe(x) should be small.ObservedExpected
Generate and Test Random NumbersGenerate and Test Random NumbersKolmogorov-Smirnov Test :
Generate and Test Random NumbersGenerate and Test Random NumbersExample:
Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
Generate and Test Random NumbersGenerate and Test Random NumbersRun Tests (Runs up and runs down):The runs test examines the arrangement of numbers in sequence to test the hypothesis of independence.
A run is defined as a succession of similar events preceded and followed by different event.

More Related Content

PPT
Reinforcement learning
PPTX
Pseudo Random Number
PPT
Random number generation
PPTX
Unit 3 random number generation, random-variate generation
PPTX
Alpha beta pruning in ai
PDF
Random number generator
PPTX
Feedforward neural network
PDF
Gomory's cutting plane method
Reinforcement learning
Pseudo Random Number
Random number generation
Unit 3 random number generation, random-variate generation
Alpha beta pruning in ai
Random number generator
Feedforward neural network
Gomory's cutting plane method

What's hot (20)

PPTX
Convolutional Neural Network and Its Applications
PPTX
Decision Tree
PPTX
Uncertain Knowledge and Reasoning in Artificial Intelligence
PPTX
Artificial Intelligence Notes Unit 3
PPT
Artificial Neural Networks - ANN
PDF
Unit 6: Application of AI
PPTX
Activation functions
PPTX
Random number generation
PDF
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
PPTX
Metaheuristics
PDF
Gradient descent method
PDF
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
PPTX
ML - Multiple Linear Regression
PPT
3 Centrality
PPTX
Regression and Classification: An Artificial Neural Network Approach
PPT
Random variate generation
PDF
Deep Feed Forward Neural Networks and Regularization
PPTX
Fuzzy logic Notes AI CSE 8th Sem
PPTX
Bayesian Neural Networks
PPTX
Polynomial regression
Convolutional Neural Network and Its Applications
Decision Tree
Uncertain Knowledge and Reasoning in Artificial Intelligence
Artificial Intelligence Notes Unit 3
Artificial Neural Networks - ANN
Unit 6: Application of AI
Activation functions
Random number generation
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
Metaheuristics
Gradient descent method
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
ML - Multiple Linear Regression
3 Centrality
Regression and Classification: An Artificial Neural Network Approach
Random variate generation
Deep Feed Forward Neural Networks and Regularization
Fuzzy logic Notes AI CSE 8th Sem
Bayesian Neural Networks
Polynomial regression
Ad

Viewers also liked (11)

PPTX
Random Number Generation
PPTX
Simulation-Run-Statistics
PPSX
Power Point Presentation
PPTX
Poisson distribution
PPT
Much ado about randomness. What is really a random number?
PPTX
Matlab Distributions
PPTX
Poisson distribution
PPTX
Pseudorandom number generators powerpoint
PPT
Simulation in terminated system
PDF
Pseudo Random Number Generators
Random Number Generation
Simulation-Run-Statistics
Power Point Presentation
Poisson distribution
Much ado about randomness. What is really a random number?
Matlab Distributions
Poisson distribution
Pseudorandom number generators powerpoint
Simulation in terminated system
Pseudo Random Number Generators
Ad

Similar to Generate and test random numbers (20)

PPTX
MT6702 Unit 2 Random Number Generation
PPT
Random Number Generation Conceptual and Practice
PPTX
Random number generation
PPTX
PPTX
Teknik Simulasi
PDF
AN ALTERNATIVE APPROACH FOR SELECTION OF PSEUDO RANDOM NUMBERS FOR ONLINE EXA...
PPT
Lecture06-Random-Number-Genedawrators.ppt
PPTX
Unit-3 of mathematical foundation of ai ml
PDF
Generating random primes
PDF
Cost Optimized Design Technique for Pseudo-Random Numbers in Cellular Automata
PDF
Random number generation (in C++) – past, present and potential future
PDF
Fv2510671071
PDF
Tools for computational finance
PPTX
4. random number and it's generating techniques
PPTX
Trust Measurement Presentation_Part 3
PDF
Random Number Generators 2018
PPT
lections tha detail aboot andom nummerss
PDF
Essentials of monte carlo simulation
PDF
Python Programming - IX. On Randomness
MT6702 Unit 2 Random Number Generation
Random Number Generation Conceptual and Practice
Random number generation
Teknik Simulasi
AN ALTERNATIVE APPROACH FOR SELECTION OF PSEUDO RANDOM NUMBERS FOR ONLINE EXA...
Lecture06-Random-Number-Genedawrators.ppt
Unit-3 of mathematical foundation of ai ml
Generating random primes
Cost Optimized Design Technique for Pseudo-Random Numbers in Cellular Automata
Random number generation (in C++) – past, present and potential future
Fv2510671071
Tools for computational finance
4. random number and it's generating techniques
Trust Measurement Presentation_Part 3
Random Number Generators 2018
lections tha detail aboot andom nummerss
Essentials of monte carlo simulation
Python Programming - IX. On Randomness

More from Mshari Alabdulkarim (6)

PPSX
Qo s provisioning for scalable video streaming over ad hoc networks using cro...
PPTX
Ad-Hoc Networks
PPSX
Improving Direct-Mapped Cache Performance by the Addition of a Small Fully-As...
PPSX
Power Saving in Wireless Sensor Networks
Qo s provisioning for scalable video streaming over ad hoc networks using cro...
Ad-Hoc Networks
Improving Direct-Mapped Cache Performance by the Addition of a Small Fully-As...
Power Saving in Wireless Sensor Networks

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Monthly Chronicles - July 2025
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Generate and test random numbers

  • 1. Generate and Test Random NumbersEng. MshariAlabdulkarim
  • 2. Generate and Test Random NumbersGenerate and Test Random NumbersRandom Number Generation
  • 3. Generate and Test Random NumbersGenerate and Test Random NumbersTypes of Random-number Generators:Combined generators.
  • 4. Inversive Generators.Generate and Test Random NumbersGenerate and Test Random NumbersWhen to use Combined Generators :In the simulation of a highly reliable systems, where we need to simulate a huge number of events to observe any error.
  • 5. In the simulation of a complex networks, where there are a huge number of users running lots of programs.Generate and Test Random NumbersGenerate and Test Random NumbersCombined Linear CongruentialGenerators :In 1988, L’Ecuyer suggested a new way to generate a sequence numbers with a very long period, and that by combining two or more congruential generators.
  • 6. If Wi,1, Wi,2,..., Wi,kare independent, discrete-valued random variables, and Wi,1 is uniformly distributed between 0 and m1 – 2, then: is also uniformly distributed between 0 and m1 – 2.
  • 7. Generate and Test Random NumbersGenerate and Test Random NumbersCombined Linear Congruential Generators (Cont):L’Ecuyer suggested to combined generator of the form:With:The maximum possible period will be:
  • 8. Generate and Test Random NumbersGenerate and Test Random NumbersExample:Two generators “k = 2”, a1 = 40014, m1 = 2147483563, a2 = 40692, m2 = 2147483399.Algorithm:Choose two seeds, X1,0 from [1, 2147483562] and X2,0 from [1, 2147483398], Set j = 0.Calculate the values from the two generators: Then calculate:After that return:Finally: j = j + 1, and then go back to step number 2.
  • 9. Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):Period:
  • 10. Generate and Test Random NumbersGenerate and Test Random NumbersInversiveCongruential Generator :Invarsivecongruential generators are a type of nonlinear congruential pseudorandom number generator.
  • 11. The standard formula for an inversivecongruential generator is:Generate and Test Random NumbersGenerate and Test Random NumbersTesting Random Number
  • 12. Generate and Test Random NumbersGenerate and Test Random NumbersTypes of Random-number Testors:Kolmogorov-Smirnov Test.
  • 13. Runs Tests.Generate and Test Random NumbersGenerate and Test Random NumbersKolmogorov-Smirnov Test :Developed by A. N. Kolmogorov and N. V. Smirnov.
  • 14. Designed for continuous distributions.
  • 15. Difference between the observed CDF (cumulative distribution function) Fo(x) and the expected cdf Fe(x) should be small.ObservedExpected
  • 16. Generate and Test Random NumbersGenerate and Test Random NumbersKolmogorov-Smirnov Test :
  • 17. Generate and Test Random NumbersGenerate and Test Random NumbersExample:
  • 18. Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
  • 19. Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
  • 20. Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):
  • 21. Generate and Test Random NumbersGenerate and Test Random NumbersRun Tests (Runs up and runs down):The runs test examines the arrangement of numbers in sequence to test the hypothesis of independence.
  • 22. A run is defined as a succession of similar events preceded and followed by different event.
  • 23. The length of the run is the number of events that occur in the run.
  • 24. There are two Concerns in a runs test:Number of runs.Length of runs.
  • 25. Generate and Test Random NumbersGenerate and Test Random NumbersRun Tests (Runs up and runs down):If N is the number of numbers in a sequence, the maximum number of runs is N-1, and the minimum number of runs is one.
  • 26. If α is the total number of runs in a truly random sequence, then:
  • 27. Mean:
  • 29. For N > 20, the distribution of “a” approximated by a normal distribution, N(ma , ).This approximation can be used to test the independence of numbers from a generator.
  • 30. Generate and Test Random NumbersGenerate and Test Random NumbersRun Tests (Runs up and runs down):The standardized normal test statistic is developed by subtracting the mean from the observed number of runs “α”, and dividing by the standard deviation. That is, the test statistic is:
  • 31. Failure to reject the hypothesis of independence occurs when: Where α is the level of significance.Fail to reject
  • 32. Generate and Test Random NumbersGenerate and Test Random NumbersExample:Based on runs up and runs down, determine whether the following sequence of 40 numbers is such that the hypothesis of independence can be rejected where a = 0.05.
  • 33. The sequence of runs up and down is as follows:+ + + -+-+- - - + + -+- - +-+- - +- - +-+ + - - + + -+- - + + -
  • 34. Generate and Test Random NumbersGenerate and Test Random NumbersExample (Cont.):There are 26 runs in this sequence. With N=40 and a=26:
  • 35. Now, the critical value is Z0.025 = 1.96, so the independence of the numbers cannot be rejected on the basis of this test.