2. Generate and Test Random Numbers Generate and Test Random Numbers Random Number Generation
3.
4.
5.
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.
8. Generate and Test Random Numbers Generate and Test Random Numbers Example: 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 Numbers Generate and Test Random Numbers Example (Cont.): Period:
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.
31. Failure to reject the hypothesis of independence occurs when: Where α is the level of significance. Fail to reject
32.
33. The sequence of runs up and down is as follows:+ + + -+-+- - - + + -+- - +-+- - +- - +-+ + - - + + -+- - + + -
34.
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.