Random Number Generators xn f xn1 xn2 where
Random Number Generators xn = f ( xn-1, xn-2) where x 0 is seed • Pseudo-random since, given the same seed, the sequence is repeatable and deterministic • Cycle length – length of repeating sequence • Example: xn = a xn-1 + b mod m seed cycle period © 2003, Carla Ellis
Testing Random Numbers Chi-Square test • Discreet distributions, large sample sizes, general • Does an observed data set satisfy a specified distribution? • Prepare a histogram of observed data – k cells k D=S i=1 (oi – ei)2 ei • D has chi-square distribution with k-1 degrees of freedom • Null hypothesis that observations come from distribution can not be rejected at significance a if computed D is less than C 2[1 -a; k-1] • Works best with equiprobable cells – cell sizes so the frequencies are equal. © 2003, Carla Ellis
Chi-Square Example (observed-expected)2 expected 6. 25 0. 49 0. 0 0. 16 0. 25 0. 04 0. 49 0. 09 0. 36 2. 25 Sum = 10. 38 whereas X 2[0. 9; 9] = 14. 68 © 2003, Carla Ellis
Testing Random Numbers Kolmogorov-Smirnov test • Continuous distributions, small sample sizes, general • Based on differences between observed and expected CDFs • If K+ and K- are smaller than K[1 -a; n] the observations are said to come from the distribution with level of significance a. K+ = n max [Fo(x) – Fe(x)] x K- = n max [Fe(x) – Fo(x)] x © 2003, Carla Ellis
Kolmogorov-Smirnov Example Fo(xi) – Fe(xi) Fe(xi+1) – Fo(xi) © 2003, Carla Ellis
Kolmogorov-Smirnov Example j/n - xj xj – (j-1)/n © 2003, Carla Ellis
Testing Random Numbers Serial-Correlation test • For a sequence of numbers, compute covariance between numbers that are k apart: xi and xi+k • Autocovariance at lag k, do for range of lags. • If the C. I. includes zero, not significant correlation Rk = n-k (U – ½)(U S n-k 1 i – ½) i=1 100(1 -a)% CI: Rk ! © 2003, Carla Ellis i+k z 1 -a/2 /(12 n-k)
Random Number Generators cycle seed period What does a test say about this sample? © 2003, Carla Ellis
Simulation Techniques Overview Simulation environments Workload parameters System Config parameters Factor levels emulation execdriven sim Result Data tracedriven sim stochastic sim © 2003, Carla Ellis -> discussion of timing-first paper
- Slides: 9