Title: Tests for Random Number Generators
1Tests for Random Number Generators
- Jin Ui Yim
- Inseok Oh
- Junghoon Yang
2Desirable properties of random numbers
3Methods to test random numbers
- Frequency test (Uniformity)Uses the chi-square
test to comparethe distribution of the set of
numbers generated to a uniform distribution. - Autocorrelation test (Independence) Tests the
correlation between numbers and compares the
sample correlation to the expected correlation,
zero.
4Frequency test (Chi-Square Method)
- Oi - the observed number in the ith class
- Ei - the expected number in the ith class
- n - the number of classes
5Frequency test (Chi-Square Method)
- For the uniform distribution, Ei , the expected
number in each class is given by for equally
spaced classes.
- N - the total number of observations
- n - the number of classes
6Generating random number source(1)
double data new double100 //This object
generates random number between 0 and 1 Random
randomGenerator new Random() for ( int n 0
n lt 100 n ) //Makes random number x
randomGenerator.nextDouble() datan x
7Generated random number
0.34 0.90 0.25 0.89 0.87 0.44 0.12 0.21
0.46 0.670.83 0.76 0.79 0.64 0.70 0.81
0.94 0.74 0.22 0.740.96 0.99 0.77 0.67
0.56 0.41 0.52 0.73 0.99 0.020.47 0.30
0.17 0.82 0.56 0.05 0.45 0.31 0.78
0.05 0.79 0.71 0.23 0.19 0.82 0.93 0.65
0.37 0.39 0.42 0.99 0.17 0.99 0.46 0.05
0.66 0.10 0.42 0.18 0.49 0.37 0.51 0.54
0.01 0.81 0.28 0.69 0.34 0.75 0.49 0.72
0.43 0.56 0.97 0.30 0.94 0.96 0.58 0.73
0.05 0.06 0.39 0.84 0.24 0.40 0.64 0.40
0.19 0.79 0.62 0.18 0.26 0.97 0.88 0.64
0.47 0.60 0.11 0.29 0.78
8Chi-Square Test Source(1)
9Chi-Square Test Source(2)
10Frequency test
- The chi-square test conducted with a0.05 to test
for whether the randomly generated data are
uniformly distributed.
- The null hypothesis of a uniform distribution is
not rejected when the result of chi-square is
smaller than the tabulated value.
11Frequency test
- double resultOfChiSquareTest ChiSquareTest(
data ) - if( resultOfChiSquareTest lt 16.9)
- System.out.println("The null hypothesis of a
uniform distribution is not
rejected.") - else
- System.out.println("The null hypothesis of a
uniform distribution is
rejected.")
12Autocorrelation Use
- Economy- Stock Market
- GIS
- Architecture Engineering
- Information Technology - CDMA
13Autocorrelation Notion
- The notion is that numbers on the sequence might
be related. - We will select the number with same distance.
14Autocorrelation
- m - m is the lag, the space between the numbers
being tested. - i - i is the index, or the number in the sequence
that you start with. - N - The number of numbers generated in a
sequence. - M - M is the largest integer such that
- Pim - the estimator that is approxomitely normal
- Qpim - the standard deviation of the estimator
15AutocorrelationEquation-Schmidt and Taylor
So, We can calculate the k value.
16AutocorrelationEquation-Schmidt and Taylor
17AutocorrelationEquation-Schmidt and Taylor
18Autocorrelation Accept / Reject
ACCEPT
Reject
Reject
19Autocorrelation Test Source
20Autocorrelation Test Source(2)
21Result
- Frequency Tests(Chi-Square)
- a 0.05,X2_0.05.9 16.9
- The result of Chi-Square 4.4
- The null hypothesis of a uniform distribution is
not rejected. - Tests for Autocorrelation
- m 5,i 2
- N 50,M(i(M1)m lt N) 8
- a 0.05,Za/2 1.96
- The result of AutoCorrelation
0.6440408970482641 - The null hypothesis of an autocorrelation is not
rejected.
0.21449970335028734 0.14016906690349618 0.16450305
18088607 0.8638687961841897 0.2909116149745625 0.0
8590384803754958 0.9533828724917218 0.993675376837
7475 0.7388814369469828 0.8008823252683048 0.05016
115669494969 0.3787119891281151 0.4768874088196027
0.34120913234270767 0.02096581516091489 0.8103991
12996363 0.8352798169604146 0.1341231494235261 0.4
0901395536426344 0.9739110447728812 0.871376353677
3295 0.645201328845651 0.27027552460170856 0.92957
96431460743 ...
22References
- Discrete Event System Simulation 4rd edition
- CH7.1, CH7.4
- http//www.unf.edu/rita0001/research/index.html(F
requency test ) - http//www.itl.nist.gov/div898/software/dataplot/r
efman1/auxillar/freqtest.htm(Autocorrelation Test
)
23References
- www.math.com
- www.wordiq.com
- www.jstor.org(durbim-watson test)
- http//210.125.93.11/economics/dteco.asp?view1wo
rd???? (economic book) - http//chejucyber.cheju.ac.kr/kanggc/em/chap5/chap
5.hwp (Jeju university)