Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

- Random numbers by Guneshwor Okram 1745 views
- Random Number Generation by Raj Bhatt 2244 views
- Random number generation by De La Salle Unive... 10937 views
- Simulation-Run-Statistics by sadiksha kafle 1302 views
- Power Point Presentation by S P Sajjan 915 views
- Unit 3 random number generation, ra... by raksharao 730 views

7,111 views

Published on

No Downloads

Total views

7,111

On SlideShare

0

From Embeds

0

Number of Embeds

65

Shares

0

Downloads

223

Comments

0

Likes

3

No embeds

No notes for slide

- 1. Generate and Test Random Numbers<br />Eng. MshariAlabdulkarim<br />
- 2. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Random Number Generation<br />
- 3. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Types of Random-number Generators:<br /><ul><li>Combined generators.
- 4. Inversive Generators.</li></li></ul><li>Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />When to use Combined Generators :<br /><ul><li>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.</li></li></ul><li>Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Combined Linear CongruentialGenerators :<br /><ul><li>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:</li></ul> is also uniformly distributed between 0 and m1 – 2.<br />
- 7. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Combined Linear Congruential Generators (Cont):<br /><ul><li>L’Ecuyer suggested to combined generator of the form:</li></ul>With:<br />The maximum possible period will be:<br />
- 8. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example:<br />Two generators “k = 2”, a1 = 40014, m1 = 2147483563, a2 = 40692, m2 = 2147483399.<br />Algorithm:<br />Choose two seeds, X1,0 from [1, 2147483562] and X2,0 from [1, 2147483398], Set j = 0.<br />Calculate the values from the two generators:<br /> Then calculate:<br />After that return:<br />Finally:<br /> j = j + 1, and then go back to step number 2.<br />
- 9. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example (Cont.):<br />Period:<br />
- 10. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />InversiveCongruential Generator :<br /><ul><li>Invarsivecongruential generators are a type of nonlinear congruential pseudorandom number generator.
- 11. The standard formula for an inversivecongruential generator is:</li></li></ul><li>Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Testing Random Number<br />
- 12. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Types of Random-number Testors:<br /><ul><li>Kolmogorov-Smirnov Test.
- 13. Runs Tests.</li></li></ul><li>Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Kolmogorov-Smirnov Test :<br /><ul><li>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.</li></ul>Observed<br />Expected<br />
- 16. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Kolmogorov-Smirnov Test :<br />
- 17. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example:<br />
- 18. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example (Cont.):<br />
- 19. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example (Cont.):<br />
- 20. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example (Cont.):<br />
- 21. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Run Tests (Runs up and runs down):<br /><ul><li>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:</li></ul>Number of runs.<br />Length of runs.<br />
- 25. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Run Tests (Runs up and runs down):<br /><ul><li>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:
- 28. Variance:
- 29. For N > 20, the distribution of “a” approximated by a normal distribution, N(ma , ).</li></ul>This approximation can be used to test the independence of numbers from a generator.<br />
- 30. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Run Tests (Runs up and runs down):<br /><ul><li>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:</li></ul> Where α is the level of significance.<br />Fail to reject<br />
- 32. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example:<br /><ul><li>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:</li></ul>+ + + -+-+- - - + + -+- - +-+- - +- - +-+ + - - + + -+- - + + -<br />
- 34. Generate and Test Random Numbers<br />Generate and Test Random Numbers<br />Example (Cont.):<br /><ul><li>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.</li>

No public clipboards found for this slide

Be the first to comment