GCD.test(x, B = 32, KS = TRUE, CSQ = TRUE, AD = TRUE, JB = TRUE, test.k = TRUE, test.g = TRUE, mu, sd, alpha = 0.05)TRUE, Kolmogorov-Smirnov goodness-of-fit test is applied.
TRUE, Chi-Square goodness-of-fit test is applied.
TRUE, Anderson-Darling goodness-of-fit test is applied.
TRUE, Jarque-Bera goodness-of-fit test is applied.
TRUE, randomness test is applied over the number of required iterations of the GCD operation.
TRUE, randomness test is applied over the value of greatest common divisor.
sig.value.k include p-value of Kolmogorov-Smirnov and Chi-Square tests, respectively.
sig.value.g include p-value of Kolmogorov-Smirnov, Chi-Square, Jarque-Bera, and Anderson-Darling tests, respectively.
Total number of integers to be tested is divided into two sets and entered as x. The GCD operation is applied to each row of x.
The number of required iterations follows a normal distribution with parameters mu and sd. Values of mu and sd are obtained by Monte Carlo simulation and given by Marsaglia and Tsang (2002) for 32-bit setting. We obtained values of mu and sd for other bit settings as mu=4.2503, sd=1.650673 for 8-bits, mu=8.8772, sd=2.38282 for 16-bits, ...for 24-bits,...
GCD that provides detailed results for the greatest common divisor operation.
RNGkind(kind = "L'Ecuyer-CMRG")
B=16 # Bit length is 16.
k=250 # Generate 250 integers.
x=array(0,dim=c(k,2))
x[,1]=round(runif(k,0,(2^B-1)))
x[,2]=round(runif(k,0,(2^B-1)))
mu=8.8772
sd=2.38282
alpha = 0.05
test=GCD.test(x,B=B,KS=TRUE,CSQ=TRUE,AD=TRUE,JB=TRUE,
test.k=TRUE,test.g=TRUE,mu=mu,sd=sd,alpha=alpha)
print(test)
Run the code above in your browser using DataLab