sitmo/0000755000176200001440000000000013414743467011422 5ustar liggesuserssitmo/inst/0000755000176200001440000000000013413722047012365 5ustar liggesuserssitmo/inst/doc/0000755000176200001440000000000013413722047013132 5ustar liggesuserssitmo/inst/doc/sitmo_internals.R0000644000176200001440000000046313413722032016464 0ustar liggesusers## #include ## // Generate engine called eng_org. ## #include ## #include ## #include ## #include ## #include ## #ifdef _OPENMP ## #ifdef _OPENMP ## PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS) ## #include sitmo/inst/doc/big_crush_test.Rmd0000644000176200001440000027626013204107660016613 0ustar liggesusers--- title: "`sitmo`'s BigCrush Results" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{`sitmo`'s BigCrush Results} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- # Introduction [TestU01](http://www.iro.umontreal.ca/~simardr/testu01/tu01.html) is a software library produced by Pierre L'Ecuyer and Richard Simard written in C that provides a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs). The suite is able to provide information on the quality of the randomness a psuedo-random number generator can produce. It is able to do so under four different branches: * Implementing (pre-programmed) RNGs; * implementing specific statistical tests; * implementing batteries of statistical tests; and * Applying tests to entire families of RNGs. [TestU01](http://www.iro.umontreal.ca/~simardr/testu01/tu01.html) offers several batteries of tests including "Small Crush" (which consists of 10 tests), "Crush" (96 tests), and "Big Crush" (106 tests). With the later test being more extensive than the previous ones. For more information about the tests available, please consult the [TestU01 userguide](http://www.iro.umontreal.ca/~simardr/testu01/guideshorttestu01.pdf). The results of the "Big Crush" test are presented next. # Results of the Test Running the Big Crush test from the TestU01 suite has yielded a complete pass rate (e.g "All tests were passed") with the specifics of each of the 103 tests being detailed below. ```{r eval = F, engine='bash'} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Starting BigCrush Version: TestU01 1.2.3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *********************************************************** Test smarsa_SerialOver calling smultin_MultinomialOver *********************************************************** HOST = Sitmos-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 1, n = 1000000000, r = 0, d = 256, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 16777216 Expected number per cell = 59.604645 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0083558402, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 16711680 Value of the statistic : 1.67e+7 p-value of test : 0.59 ----------------------------------------------- CPU time used : 00:01:04.53 Generator state: *********************************************************** Test smarsa_SerialOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 1, n = 1000000000, r = 22, d = 256, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 16777216 Expected number per cell = 59.604645 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0083558402, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 16711680 Value of the statistic : 1.67e+7 p-value of test : 0.42 ----------------------------------------------- CPU time used : 00:01:08.78 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 2097152, t = 2, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1445 p-value of test : 0.02 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334565 j = 1 : 599997110 j = 2 : 1445 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:03:49.93 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 9, d = 2097152, t = 2, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1294 p-value of test : 0.97 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334414 j = 1 : 599997412 j = 2 : 1294 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:03:44.17 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 16384, t = 3, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1341 p-value of test : 0.73 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334461 j = 1 : 599997318 j = 2 : 1341 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:43.85 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 16, d = 16384, t = 3, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1401 p-value of test : 0.16 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334521 j = 1 : 599997198 j = 2 : 1401 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:38.33 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 64, t = 7, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1363 p-value of test : 0.51 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334483 j = 1 : 599997274 j = 2 : 1363 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:45.35 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 24, d = 64, t = 7, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1312 p-value of test : 0.92 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334432 j = 1 : 599997376 j = 2 : 1312 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:41.50 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 8, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1373 p-value of test : 0.41 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334493 j = 1 : 599997254 j = 2 : 1373 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:45.18 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 27, d = 8, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1360 p-value of test : 0.54 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334480 j = 1 : 599997280 j = 2 : 1360 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:41.13 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 4, t = 21, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1355 p-value of test : 0.59 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334475 j = 1 : 599997290 j = 2 : 1355 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:43.98 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 28, d = 4, t = 21, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1387 p-value of test : 0.27 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334507 j = 1 : 599997226 j = 2 : 1387 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:39.21 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 100, n = 10000000, r = 0, d = 2147483648, t = 2, p = 1 Number of cells = d^t = 4611686018427387904 Lambda = Poisson mean = 54.2101 ---------------------------------------------------- Total expected number = N*Lambda : 5421.01 Total observed number : 5379 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:03:58.55 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 0, d = 2097152, t = 3, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4347 p-value of test : 0.44 ----------------------------------------------- CPU time used : 00:01:44.53 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 14, d = 65536, t = 4, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7383 p-value of test : 0.23 ----------------------------------------------- CPU time used : 00:02:48.51 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 0, d = 512, t = 7, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4299 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:59.94 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 7, d = 512, t = 7, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4377 p-value of test : 0.27 ----------------------------------------------- CPU time used : 00:02:05.76 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 14, d = 256, t = 8, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7325 p-value of test : 0.47 ----------------------------------------------- CPU time used : 00:03:19.07 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 22, d = 256, t = 8, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7294 p-value of test : 0.61 ----------------------------------------------- CPU time used : 00:03:19.19 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 0, d = 16, t = 16, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7366 p-value of test : 0.29 ----------------------------------------------- CPU time used : 00:04:00.28 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 26, d = 16, t = 16, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7357 p-value of test : 0.33 ----------------------------------------------- CPU time used : 00:04:19.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 30, n = 6000000, r = 0, t = 3, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 0.30 p-value of test : 0.93 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.55 p-value of test : 0.69 Test on the Nm values of W_{n,i}(mNP1): 1.63 p-value of test : 0.15 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 900 Number of jumps of Y : 970 p-value of test : 0.01 Stat. AD (mNP2) : 1.27 p-value of test : 0.24 Stat. AD after spacings (mNP2-S) : 1.48 p-value of test : 0.18 ----------------------------------------------- CPU time used : 00:02:35.76 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 20, n = 4000000, r = 0, t = 5, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 1.33 p-value of test : 0.22 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.58 p-value of test : 0.67 Test on the Nm values of W_{n,i}(mNP1): 0.76 p-value of test : 0.51 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 600 Number of jumps of Y : 577 p-value of test : 0.82 Stat. AD (mNP2) : 1.31 p-value of test : 0.23 Stat. AD after spacings (mNP2-S) : 0.81 p-value of test : 0.48 ----------------------------------------------- CPU time used : 00:01:45.47 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 10, n = 3000000, r = 0, t = 9, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 0.52 p-value of test : 0.73 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.29 p-value of test : 0.94 Test on the Nm values of W_{n,i}(mNP1): 1.48 p-value of test : 0.18 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 300 Number of jumps of Y : 260 p-value of test : 0.99 Stat. AD (mNP2) : 0.71 p-value of test : 0.55 Stat. AD after spacings (mNP2-S) : 0.62 p-value of test : 0.63 ----------------------------------------------- CPU time used : 00:02:55.40 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 5, n = 2000000, r = 0, t = 16, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 1.24 p-value of test : 0.25 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.54 p-value of test : 0.70 Test on the Nm values of W_{n,i}(mNP1): 1.31 p-value of test : 0.23 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 150 Number of jumps of Y : 150 p-value of test : 0.51 Stat. AD (mNP2) : 3.70 p-value of test : 0.01 Stat. AD after spacings (mNP2-S) : 0.89 p-value of test : 0.42 ----------------------------------------------- CPU time used : 00:03:22.78 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 400000000, r = 0, d = 8, k = 8 ----------------------------------------------- Number of degrees of freedom : 7 Chi-square statistic : 5.92 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:00:59.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 400000000, r = 27, d = 8, k = 8 ----------------------------------------------- Number of degrees of freedom : 7 Chi-square statistic : 3.46 p-value of test : 0.84 ----------------------------------------------- CPU time used : 00:01:09.35 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 100000000, r = 0, d = 32, k = 32 ----------------------------------------------- Number of degrees of freedom : 18 Chi-square statistic : 9.52 p-value of test : 0.95 ----------------------------------------------- CPU time used : 00:01:02.60 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 100000000, r = 25, d = 32, k = 32 ----------------------------------------------- Number of degrees of freedom : 18 Chi-square statistic : 14.29 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:13.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 0, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 44.18 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:01:16.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 10, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 47.86 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:28.55 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 20, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 50.86 p-value of test : 0.60 ----------------------------------------------- CPU time used : 00:01:28.60 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 27, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 58.93 p-value of test : 0.30 ----------------------------------------------- CPU time used : 00:01:28.68 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 500000000, r = 0, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 232 Chi-square statistic : 214.26 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:01:32.96 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 300000000, r = 25, Alpha = 0, Beta = 0.03125 ----------------------------------------------- Number of degrees of freedom : 434 Chi-square statistic : 397.76 p-value of test : 0.89 ----------------------------------------------- CPU time used : 00:02:06.14 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 100000000, r = 0, Alpha = 0, Beta = 0.0078125 ----------------------------------------------- Number of degrees of freedom : 1437 Chi-square statistic : 1481.41 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:02:13.51 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 10000000, r = 20, Alpha = 0, Beta = 0.000976562 ----------------------------------------------- Number of degrees of freedom : 7046 Chi-square statistic : 7166.64 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:02:08.09 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Run test: ----------------------------------------------- N = 5, n = 1000000000, r = 0, Up = FALSE ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.50 p-value of test : 0.05 Kolmogorov-Smirnov- statistic = D- : 0.14 p-value of test : 0.77 Anderson-Darling statistic = A2 : 2.25 p-value of test : 0.07 Test on the sum of all N observations Number of degrees of freedom : 30 Chi-square statistic : 22.54 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:01:23.93 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Run test: ----------------------------------------------- N = 10, n = 1000000000, r = 15, Up = TRUE ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.21 p-value of test : 0.35 Kolmogorov-Smirnov- statistic = D- : 0.15 p-value of test : 0.59 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 60 Chi-square statistic : 58.53 p-value of test : 0.53 ----------------------------------------------- CPU time used : 00:03:11.42 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 1000000000, r = 5, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 6 Expected number per cell = 1.6666667e+08 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 2.5000002e-09, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 5 Value of the statistic : 8.17 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:00:46.93 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 1000000000, r = 5, t = 5, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 120 Expected number per cell = 8333333.3 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 5.9500005e-08, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 119 Value of the statistic : 108.58 p-value of test : 0.74 ----------------------------------------------- CPU time used : 00:01:35.02 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 500000000, r = 5, t = 7, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 5040 Expected number per cell = 99206.349 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 5.0390004e-06, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 5039 Value of the statistic : 4810.30 p-value of test : 0.99 ----------------------------------------------- CPU time used : 00:01:24.63 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 500000000, r = 10, t = 10, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 3628800 Expected number per cell = 137.7866 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0036287993, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 3628799 Value of the statistic : 3.63e+6 p-value of test : 0.80 ----------------------------------------------- CPU time used : 00:03:06.50 Generator state: *********************************************************** Test sknuth_CollisionPermut calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 20, n = 20000000, r = 0, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellPermut Number of cells = t! = 87178291200 Expected number per cell = 1 / 4358.9146 EColl = n^2 / (2k) = 2294.14912 Hashing = TRUE Collision test, Mu = 2293.9736, Sigma = 47.8841 ----------------------------------------------- Test Results for Collisions For the total number of collisions, we use the Poisson approximation: Expected number of collisions = N*Mu : 45879.47 Observed number of collisions : 45892 p-value of test : 0.48 ----------------------------- Total number of cells containing j balls j = 0 : 1743165869892 j = 1 : 399908218 j = 2 : 45888 j = 3 : 2 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:54.47 Generator state: *********************************************************** Test sknuth_CollisionPermut calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 20, n = 20000000, r = 10, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellPermut Number of cells = t! = 87178291200 Expected number per cell = 1 / 4358.9146 EColl = n^2 / (2k) = 2294.14912 Hashing = TRUE Collision test, Mu = 2293.9736, Sigma = 47.8841 ----------------------------------------------- Test Results for Collisions For the total number of collisions, we use the Poisson approximation: Expected number of collisions = N*Mu : 45879.47 Observed number of collisions : 45960 p-value of test : 0.35 ----------------------------- Total number of cells containing j balls j = 0 : 1743165869960 j = 1 : 399908084 j = 2 : 45952 j = 3 : 4 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:05:01.14 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 40, n = 10000000, r = 0, d = 100000, t = 8 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.11 p-value of test : 0.35 Kolmogorov-Smirnov- statistic = D- : 0.036 p-value of test : 0.88 Anderson-Darling statistic = A2 : 0.61 p-value of test : 0.64 Test on the sum of all N observations Number of degrees of freedom : 3999960 Chi-square statistic : 4.00e+6 p-value of test : 0.77 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.091 p-value of test : 0.49 Kolmogorov-Smirnov- statistic = D- : 0.054 p-value of test : 0.77 Anderson-Darling statistic = A2 : 0.41 p-value of test : 0.84 ----------------------------------------------- CPU time used : 00:01:45.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 30, n = 10000000, r = 0, d = 100000, t = 16 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.13 p-value of test : 0.32 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.17 Anderson-Darling statistic = A2 : 1.26 p-value of test : 0.25 Test on the sum of all N observations Number of degrees of freedom : 2999970 Chi-square statistic : 3.00e+6 p-value of test : 0.40 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.19 p-value of test : 0.11 Kolmogorov-Smirnov- statistic = D- : 0.014 p-value of test : 0.98 Anderson-Darling statistic = A2 : 1.61 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:01:43.48 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 20, n = 10000000, r = 0, d = 100000, t = 24 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.15 p-value of test : 0.38 Kolmogorov-Smirnov- statistic = D- : 0.12 p-value of test : 0.54 Anderson-Darling statistic = A2 : 0.55 p-value of test : 0.69 Test on the sum of all N observations Number of degrees of freedom : 1999980 Chi-square statistic : 2.00e+6 p-value of test : 0.64 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.040 p-value of test : 0.91 Kolmogorov-Smirnov- statistic = D- : 0.19 p-value of test : 0.23 Anderson-Darling statistic = A2 : 0.94 p-value of test : 0.39 ----------------------------------------------- CPU time used : 00:01:27.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 20, n = 10000000, r = 0, d = 100000, t = 32 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.12 p-value of test : 0.51 Kolmogorov-Smirnov- statistic = D- : 0.100 p-value of test : 0.63 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 1999980 Chi-square statistic : 2.00e+6 p-value of test : 0.64 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.10 p-value of test : 0.61 Kolmogorov-Smirnov- statistic = D- : 0.16 p-value of test : 0.33 Anderson-Darling statistic = A2 : 0.79 p-value of test : 0.48 ----------------------------------------------- CPU time used : 00:01:43.31 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 40, n = 10000000, r = 0, t = 8 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.18 p-value of test : 0.06 Kolmogorov-Smirnov- statistic = D- : 0.049 p-value of test : 0.80 Anderson-Darling statistic = A2 : 1.90 p-value of test : 0.10 ----------------------------------------------- CPU time used : 00:01:54.64 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 20, n = 10000000, r = 0, t = 16 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.24 p-value of test : 0.08 Kolmogorov-Smirnov- statistic = D- : 0.043 p-value of test : 0.90 Anderson-Darling statistic = A2 : 2.22 p-value of test : 0.07 ----------------------------------------------- CPU time used : 00:01:29.65 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 20, n = 10000000, r = 0, t = 24 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.23 p-value of test : 0.10 Kolmogorov-Smirnov- statistic = D- : 0.012 p-value of test : 0.98 Anderson-Darling statistic = A2 : 1.69 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:02:04.43 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleMean test: ----------------------------------------------- N = 20000000, n = 30, r = 0 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 1.93e-4 p-value of test : 0.22 Kolmogorov-Smirnov- statistic = D- : 7.01e-5 p-value of test : 0.82 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 ----------------------------------------------- CPU time used : 00:00:15.09 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleMean test: ----------------------------------------------- N = 20000000, n = 30, r = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 1.37e-4 p-value of test : 0.47 Kolmogorov-Smirnov- statistic = D- : 1.31e-4 p-value of test : 0.50 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.76 ----------------------------------------------- CPU time used : 00:00:15.52 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleCorr test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, k = 1 ----------------------------------------------- Normal statistic : -1.75 p-value of test : 0.96 ----------------------------------------------- CPU time used : 00:00:23.87 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleCorr test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, k = 2 ----------------------------------------------- Normal statistic : 1.09 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:00:23.96 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_AppearanceSpacings test: ----------------------------------------------- N = 1, Q = 10000000, K = 1000000000, r = 0, s = 3, L = 15 Sequences of n = (K + Q)L = 15150000000 bits Q = 10000000 initialization blocks K = 1000000000 blocks for the test the blocks have L = 15 bits ----------------------------------------------- Normal statistic : -0.31 p-value of test : 0.62 ----------------------------------------------- CPU time used : 00:01:09.11 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_AppearanceSpacings test: ----------------------------------------------- N = 1, Q = 10000000, K = 1000000000, r = 27, s = 3, L = 15 Sequences of n = (K + Q)L = 15150000000 bits Q = 10000000 initialization blocks K = 1000000000 blocks for the test the blocks have L = 15 bits ----------------------------------------------- Normal statistic : -0.77 p-value of test : 0.78 ----------------------------------------------- CPU time used : 00:01:12.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 0, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 53.51 p-value of test : 0.88 ----------------------------------------------- CPU time used : 00:00:53.06 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 20, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 76.46 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:01:05.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 28, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 66.46 p-value of test : 0.50 ----------------------------------------------- CPU time used : 00:01:05.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 0, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 32.57 p-value of test : 0.68 ----------------------------------------------- CPU time used : 00:00:53.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 10, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 53.95 p-value of test : 0.04 ----------------------------------------------- CPU time used : 00:01:05.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 26, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 18.95 p-value of test : 0.9939 ----------------------------------------------- CPU time used : 00:01:05.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SumCollector test: ----------------------------------------------- N = 1, n = 500000000, r = 0, g = 10 ----------------------------------------------- Number of degrees of freedom : 29 Chi-square statistic : 22.00 p-value of test : 0.82 ----------------------------------------------- CPU time used : 00:01:58.36 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 10, n = 1000000, r = 0, s = 5, L = 30, k = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.27 p-value of test : 0.19 Kolmogorov-Smirnov- statistic = D- : 0.16 p-value of test : 0.56 Anderson-Darling statistic = A2 : 0.78 p-value of test : 0.50 Test on the sum of all N observations Number of degrees of freedom : 40 Chi-square statistic : 32.66 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:01:16.26 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 10, n = 1000000, r = 25, s = 5, L = 30, k = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.19 p-value of test : 0.42 Kolmogorov-Smirnov- statistic = D- : 0.14 p-value of test : 0.62 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 40 Chi-square statistic : 34.46 p-value of test : 0.72 ----------------------------------------------- CPU time used : 00:01:16.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 5000, r = 0, s = 4, L = 1000, k = 1000 ----------------------------------------------- Number of degrees of freedom : 3 Chi-square statistic : 0.73 p-value of test : 0.87 ----------------------------------------------- CPU time used : 00:03:44.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 5000, r = 26, s = 4, L = 1000, k = 1000 ----------------------------------------------- Number of degrees of freedom : 3 Chi-square statistic : 1.12 p-value of test : 0.77 ----------------------------------------------- CPU time used : 00:03:44.77 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 80, r = 15, s = 15, L = 5000, k = 5000 ----------------------------------------------- Number of degrees of freedom : 2 Chi-square statistic : 6.04 p-value of test : 0.05 ----------------------------------------------- CPU time used : 00:03:28.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 80, r = 0, s = 30, L = 5000, k = 5000 ----------------------------------------------- Number of degrees of freedom : 2 Chi-square statistic : 0.075 p-value of test : 0.96 ----------------------------------------------- CPU time used : 00:02:51.20 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_Savir2 test: ----------------------------------------------- N = 10, n = 10000000, r = 10, m = 1048576, t = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.027 p-value of test : 0.97 Kolmogorov-Smirnov- statistic = D- : 0.41 p-value of test : 0.02 Anderson-Darling statistic = A2 : 2.58 p-value of test : 0.05 Test on the sum of all N observations Number of degrees of freedom : 130 Chi-square statistic : 164.06 p-value of test : 0.02 ----------------------------------------------- CPU time used : 00:00:37.67 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_GCD test: ----------------------------------------------- N = 10, n = 50000000, r = 0, s = 30 ----------------------------------------------- Test results for GCD values: Kolmogorov-Smirnov+ statistic = D+ : 0.34 p-value of test : 0.08 Kolmogorov-Smirnov- statistic = D- : 0.026 p-value of test : 0.97 Anderson-Darling statistic = A2 : 1.62 p-value of test : 0.15 Test on the sum of all N observations Number of degrees of freedom : 17430 Chi-square statistic :17122.72 p-value of test : 0.95 ----------------------------------------------- CPU time used : 00:01:54.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 100000000, r = 0, s = 5, L0 = 50, L1 = 50 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 36 ChiSquare statistic : 30.27 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 35 ChiSquare statistic : 34.79 p-value of test : 0.48 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 25 ChiSquare statistic : 34.88 p-value of test : 0.09 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 24 ChiSquare statistic : 25.02 p-value of test : 0.40 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 17 ChiSquare statistic : 24.18 p-value of test : 0.11 ----------------------------------------------- CPU time used : 00:00:47.70 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 100000000, r = 25, s = 5, L0 = 50, L1 = 50 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 36 ChiSquare statistic : 26.87 p-value of test : 0.86 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 35 ChiSquare statistic : 25.33 p-value of test : 0.89 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 25 ChiSquare statistic : 40.08 p-value of test : 0.03 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 24 ChiSquare statistic : 19.29 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 17 ChiSquare statistic : 11.45 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:00:48.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 10000000, r = 0, s = 10, L0 = 1000, L1 = 1000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 146 ChiSquare statistic : 177.55 p-value of test : 0.04 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 146 ChiSquare statistic : 117.36 p-value of test : 0.96 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 500 ChiSquare statistic : 438.13 p-value of test : 0.98 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 136 ChiSquare statistic : 119.76 p-value of test : 0.84 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 74 ChiSquare statistic : 86.45 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:01:06.36 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 10000000, r = 20, s = 10, L0 = 1000, L1 = 1000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 146 ChiSquare statistic : 128.52 p-value of test : 0.85 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 146 ChiSquare statistic : 139.85 p-value of test : 0.63 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 500 ChiSquare statistic : 509.00 p-value of test : 0.38 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 136 ChiSquare statistic : 125.25 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 74 ChiSquare statistic : 68.45 p-value of test : 0.66 ----------------------------------------------- CPU time used : 00:01:08.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 1000000, r = 0, s = 15, L0 = 10000, L1 = 10000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 384 ChiSquare statistic : 396.65 p-value of test : 0.32 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 384 ChiSquare statistic : 387.98 p-value of test : 0.43 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 5000 ChiSquare statistic : 4987.07 p-value of test : 0.55 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 378 ChiSquare statistic : 370.70 p-value of test : 0.60 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 200 ChiSquare statistic : 202.48 p-value of test : 0.44 ----------------------------------------------- CPU time used : 00:00:57.94 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 1000000, r = 15, s = 15, L0 = 10000, L1 = 10000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 384 ChiSquare statistic : 370.10 p-value of test : 0.69 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 384 ChiSquare statistic : 369.10 p-value of test : 0.70 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 5000 ChiSquare statistic : 4890.41 p-value of test : 0.86 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 378 ChiSquare statistic : 357.68 p-value of test : 0.77 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 200 ChiSquare statistic : 180.54 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:00:58.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LinearComp test: ----------------------------------------------- N = 1, n = 400020, r = 0, s = 1 ----------------------------------------------- Number of degrees of freedom : 12 Chi2 statistic for size of jumps : 12.60 p-value of test : 0.40 ----------------------------------------------- Normal statistic for number of jumps : 2.51 p-value of test : 6.1e-3 ----------------------------------------------- CPU time used : 00:02:43.68 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LinearComp test: ----------------------------------------------- N = 1, n = 400020, r = 29, s = 1 ----------------------------------------------- Number of degrees of freedom : 12 Chi2 statistic for size of jumps : 8.18 p-value of test : 0.77 ----------------------------------------------- Normal statistic for number of jumps : -1.55 p-value of test : 0.94 ----------------------------------------------- CPU time used : 00:02:43.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LempelZiv test: ----------------------------------------------- N = 10, n = 134217728, r = 0, s = 30, k = 27 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.23 p-value of test : 0.31 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.65 Anderson-Darling statistic = A2 : 0.54 p-value of test : 0.70 Tests on the sum of all N observations Standardized normal statistic : -0.32 p-value of test : 0.63 Sample variance : 1.17 p-value of test : 0.31 ----------------------------------------------- CPU time used : 00:00:54.70 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LempelZiv test: ----------------------------------------------- N = 10, n = 134217728, r = 15, s = 15, k = 27 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.20 p-value of test : 0.40 Kolmogorov-Smirnov- statistic = D- : 0.015 p-value of test : 0.98 Anderson-Darling statistic = A2 : 0.73 p-value of test : 0.53 Tests on the sum of all N observations Standardized normal statistic : -1.20 p-value of test : 0.88 Sample variance : 0.89 p-value of test : 0.53 ----------------------------------------------- CPU time used : 00:00:55.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sspectral_Fourier3 test: ----------------------------------------------- N = 100000, n = 16384, r = 0, s = 3, k = 14 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.021 p-value of test : 0.02 Kolmogorov-Smirnov- statistic = D- : 9.76e-3 p-value of test : 0.46 Anderson-Darling statistic = A2 : 2.29 p-value of test : 0.06 ----------------------------------------------- CPU time used : 00:00:39.04 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sspectral_Fourier3 test: ----------------------------------------------- N = 100000, n = 16384, r = 27, s = 3, k = 14 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.016 p-value of test : 0.11 Kolmogorov-Smirnov- statistic = D- : 4.76e-3 p-value of test : 0.83 Anderson-Darling statistic = A2 : 1.57 p-value of test : 0.16 ----------------------------------------------- CPU time used : 00:00:39.54 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_LongestHeadRun test: ----------------------------------------------- N = 1, n = 1000, r = 0, s = 3, L = 10000020 ----------------------------------------------- Number of degrees of freedom : 8 Chi-square statistic : 9.12 p-value of test : 0.33 ----------------------------------------------- Global longest run of 1 : 35.00 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:01:47.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_LongestHeadRun test: ----------------------------------------------- N = 1, n = 1000, r = 27, s = 3, L = 10000020 ----------------------------------------------- Number of degrees of freedom : 8 Chi-square statistic : 4.78 p-value of test : 0.78 ----------------------------------------------- Global longest run of 1 : 35.00 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:01:50.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_PeriodsInStrings test: ----------------------------------------------- N = 10, n = 500000000, r = 0, s = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.30 p-value of test : 0.13 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.68 Anderson-Darling statistic = A2 : 0.84 p-value of test : 0.45 Test on the sum of all N observations Number of degrees of freedom : 200 Chi-square statistic : 183.59 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:02:51.45 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_PeriodsInStrings test: ----------------------------------------------- N = 10, n = 500000000, r = 20, s = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.25 p-value of test : 0.25 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.51 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 Test on the sum of all N observations Number of degrees of freedom : 200 Chi-square statistic : 195.89 p-value of test : 0.57 ----------------------------------------------- CPU time used : 00:02:56.45 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingWeight2 test: ----------------------------------------------- N = 10, n = 1000000000, r = 0, s = 3, L = 1000000 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.15 p-value of test : 0.57 Kolmogorov-Smirnov- statistic = D- : 0.19 p-value of test : 0.43 Anderson-Darling statistic = A2 : 1.02 p-value of test : 0.34 Test on the sum of all N observations Number of degrees of freedom : 10000 Chi-square statistic :10157.86 p-value of test : 0.13 ----------------------------------------------- CPU time used : 00:00:57.75 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingWeight2 test: ----------------------------------------------- N = 10, n = 1000000000, r = 27, s = 3, L = 1000000 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.18 p-value of test : 0.48 Kolmogorov-Smirnov- statistic = D- : 0.38 p-value of test : 0.04 Anderson-Darling statistic = A2 : 1.47 p-value of test : 0.18 Test on the sum of all N observations Number of degrees of freedom : 10000 Chi-square statistic :10121.19 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:01:01.20 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 1000000000, r = 10, s = 10, L = 30 ----------------------------------------------- Normal statistic : 1.36 p-value of test : 0.09 ----------------------------------------------- CPU time used : 00:01:13.01 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 100000000, r = 10, s = 10, L = 300 ----------------------------------------------- Normal statistic : 0.36 p-value of test : 0.36 ----------------------------------------------- CPU time used : 00:01:09.29 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 100000000, r = 10, s = 10, L = 1200 ----------------------------------------------- Normal statistic : -0.12 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:04:34.86 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 10, n = 30000000, r = 0, s = 3, L = 30, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.24 p-value of test : 0.28 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.65 Anderson-Darling statistic = A2 : 0.74 p-value of test : 0.53 Test on the sum of all N observations Number of degrees of freedom : 4890 Chi-square statistic : 4850.28 p-value of test : 0.65 ----------------------------------------------- CPU time used : 00:01:53.80 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 10, n = 30000000, r = 27, s = 3, L = 30, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.25 p-value of test : 0.24 Kolmogorov-Smirnov- statistic = D- : 0.11 p-value of test : 0.74 Anderson-Darling statistic = A2 : 0.66 p-value of test : 0.59 Test on the sum of all N observations Number of degrees of freedom : 4890 Chi-square statistic : 4816.01 p-value of test : 0.77 ----------------------------------------------- CPU time used : 00:01:59.57 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 30000000, r = 0, s = 4, L = 300, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 4117 Chi-square statistic : 4183.44 p-value of test : 0.23 ----------------------------------------------- CPU time used : 00:01:25.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 30000000, r = 26, s = 4, L = 300, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 4117 Chi-square statistic : 4147.28 p-value of test : 0.37 ----------------------------------------------- CPU time used : 00:01:29.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 10000000, r = 0, s = 5, L = 1200, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 11825 Chi-square statistic :11803.57 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:01:33.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 10000000, r = 25, s = 5, L = 1200, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 11825 Chi-square statistic :11791.39 p-value of test : 0.58 ----------------------------------------------- CPU time used : 00:01:38.25 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_Run test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, s = 3 ----------------------------------------------- Total number of 1 runs: 2000000000 Number of degrees of freedom : 54 Chi2 statistic for number of runs : 62.56 p-value of test : 0.20 ----------------------------------------------- Total number of bits: 7999957470 Normal statistic for number of bits : -0.34 p-value of test : 0.63 ----------------------------------------------- CPU time used : 00:01:16.00 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_Run test: ----------------------------------------------- N = 1, n = 2000000000, r = 27, s = 3 ----------------------------------------------- Total number of 1 runs: 2000000000 Number of degrees of freedom : 54 Chi2 statistic for number of runs : 65.11 p-value of test : 0.14 ----------------------------------------------- Total number of bits: 7999956321 Normal statistic for number of bits : -0.35 p-value of test : 0.64 ----------------------------------------------- CPU time used : 00:01:18.57 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000030, r = 0, s = 3, d = 1 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.28 p-value of test : 0.18 Kolmogorov-Smirnov- statistic = D- : 0.10 p-value of test : 0.76 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 Tests on the sum of all N observations Standardized normal statistic : -0.51 p-value of test : 0.69 Sample variance : 0.71 p-value of test : 0.70 ----------------------------------------------- CPU time used : 00:02:49.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000029, r = 0, s = 3, d = 3 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.13 p-value of test : 0.66 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.51 Anderson-Darling statistic = A2 : 0.30 p-value of test : 0.94 Tests on the sum of all N observations Standardized normal statistic : 0.069 p-value of test : 0.47 Sample variance : 0.68 p-value of test : 0.73 ----------------------------------------------- CPU time used : 00:02:30.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000030, r = 27, s = 3, d = 1 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.095 p-value of test : 0.78 Kolmogorov-Smirnov- statistic = D- : 0.30 p-value of test : 0.14 Anderson-Darling statistic = A2 : 1.01 p-value of test : 0.35 Tests on the sum of all N observations Standardized normal statistic : 0.45 p-value of test : 0.33 Sample variance : 1.52 p-value of test : 0.13 ----------------------------------------------- CPU time used : 00:02:51.88 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000029, r = 27, s = 3, d = 3 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.079 p-value of test : 0.84 Kolmogorov-Smirnov- statistic = D- : 0.18 p-value of test : 0.48 Anderson-Darling statistic = A2 : 0.59 p-value of test : 0.65 Tests on the sum of all N observations Standardized normal statistic : 0.78 p-value of test : 0.22 Sample variance : 1.85 p-value of test : 0.05 ----------------------------------------------- CPU time used : 00:02:32.94 Generator state: ========= Summary results of BigCrush ========= Version: TestU01 1.2.3 Generator: sitmo Number of statistics: 160 Total CPU time: 03:44:06.82 All tests were passed ```sitmo/inst/doc/big_crush_test.R0000644000176200001440000000010013413722032016242 0ustar liggesusers## xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx sitmo/inst/doc/uniform_rng_with_sitmo.Rmd0000644000176200001440000001352213314572527020402 0ustar liggesusers--- title: "Making a Uniform PRNG with `sitmo`" author: "James Balamuta" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Making a Uniform PRNG with `sitmo`} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Intro Many of the random number generators for various distributions rely on the Probability Integral Transformation theorem. Succintly stated as: **Theorem** Let $X$ be a random variable that has a cumulative distribution function (CDF) of $F_X\left({x}\right)$. Then, define random variable $U = F_X\left({X}\right)$. Thus, $U$ is a uniform distribution. **Proof** Given any random variable **X**, define $U = F_X\left({X}\right)$. Then: $$\begin{align*} F_U\left({u}\right) &= P\left( {U \le u} \right) \\ &= P\left( {{F_X}\left( X \right) \le u} \right) \\ &= P\left( {X \le F_X^{ - 1}\left( u \right)} \right) \\ &= {F_X}\left( {F_X^{ - 1}\left( u \right)} \right) \\ &= u \\ \end{align*}$$ Therefore, $F_U\left({u}\right)$ is the CDF of a Uniform(0,1) RV. Hence, $U$ has a uniform distribution on $[0,1]$. # Random Uniform Distribution (runif) in C++ Within the R/C++ API, there are three ways one can use a random uniform distribution. - Through the use of `Rcpp`'s hook into the `Rmath.h` library that controls random generation via `R::runif(a,b)` or Rcpp's sugar `Rcpp::runif(n,a,b)`. - By using C++11's [built-in generators and statistical distributions](http://en.cppreference.com/w/cpp/numeric/random) to create a uniform real random variable generator. ```{r cppN, eval = F, engine='Rcpp'} #include #include // [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] void test(unsigned int n, double a, double b) { // Random Seed std::random_device rd; // Random engine std::mt19937 mt(rd()); // Uniform Distribution std::uniform_real_distribution dist(a, b); // Generate n realizations for (unsigned int i=0; i #include // [[Rcpp::depends(sitmo)]] //' Random Uniform Number Generator with sitmo //' //' The function provides an implementation of sampling from a random uniform distribution //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param seed A special \code{unsigned integer} containing a single seed. //' @return A \code{vec} containing the realizations. //' @export //' @examples //' a = runif_sitmo(10) // [[Rcpp::export]] Rcpp::NumericVector runif_sitmo(unsigned int n, double min = 0.0, double max = 1.0, uint32_t seed = 1) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng(seed); // Obtain the range between max and min double dis = max - min; for(unsigned int i = 0; i < n; ++i) { // Sample from the RNG and divide it by the maximum value possible // (c.f. SITMO_RAND_MAX, which is 4294967295) // Apply appropriate scale dis = (MAX-MIN) and add min starting loc o[i] = min + ((double) eng() / (sitmo::prng::max())) * (dis); } return o; } ``` To verify the quality of sitmo in an informal way, we can test the dependency or correlation between the seeds. To do so, we generate the same number of realizations under different seeds that have a range. With this being said, we consider the following code: ```{r correlation} # Load packages library(ggplot2) library(sitmo) # Number of Observations to Generate n = 1e6 # Number of seeds to try (1 ... S) nseeds = 30 # Storage for seed number and the correlation of the realizations between generators. cppdf = data.frame(s1 = numeric(nseeds), s2 = numeric(nseeds), cor = numeric(nseeds), stringsAsFactors = F) # Generate observations under the seeds count = 0 for(i in seq_len(nseeds)){ for(j in i:nseeds){ u1 = runif_sitmo(n, 0.0, 1.0, i) u2 = runif_sitmo(n, 0.0, 1.0, j) count = count + 1 cppdf[count,] = c(i, j, cor(u1,u2)) } } ``` We can visualize the data by using a correlation graph. In this case, the generations off the diagonal should have no correlation ($r = 0$) whereas the seeds on the diagonal should have a correlation of 1 ($r = 1$). ```{r corr_plot, fig.width = 7, fig.height = 4} # Create Correlation Plot ggplot(cppdf) + geom_tile(aes(x = s1, y = s2, fill = cor)) + xlab("Seed 1") + ylab("Seed 2") + ggtitle("Correlations between seed realizations using `sitmo`") + theme_bw() ``` Observing the correlation graph, we note that the pattern predicted - only correlation on the diagonal - exists. Thus, the generation under these seeds are ideal. sitmo/inst/doc/uniform_rng_with_sitmo.html0000644000176200001440000015623013413722047020622 0ustar liggesusers Making a Uniform PRNG with sitmo

Making a Uniform PRNG with sitmo

James Balamuta

2019-01-04

Intro

Many of the random number generators for various distributions rely on the Probability Integral Transformation theorem. Succintly stated as:

Theorem

Let \(X\) be a random variable that has a cumulative distribution function (CDF) of \(F_X\left({x}\right)\). Then, define random variable \(U = F_X\left({X}\right)\). Thus, \(U\) is a uniform distribution.

Proof

Given any random variable X, define \(U = F_X\left({X}\right)\). Then:

\[\begin{align*} F_U\left({u}\right) &= P\left( {U \le u} \right) \\ &= P\left( {{F_X}\left( X \right) \le u} \right) \\ &= P\left( {X \le F_X^{ - 1}\left( u \right)} \right) \\ &= {F_X}\left( {F_X^{ - 1}\left( u \right)} \right) \\ &= u \\ \end{align*}\]

Therefore, \(F_U\left({u}\right)\) is the CDF of a Uniform(0,1) RV. Hence, \(U\) has a uniform distribution on \([0,1]\).

Random Uniform Distribution (runif) in C++

Within the R/C++ API, there are three ways one can use a random uniform distribution.

  • Through the use of Rcpp’s hook into the Rmath.h library that controls random generation via R::runif(a,b) or Rcpp’s sugar Rcpp::runif(n,a,b).
  • By using C++11’s built-in generators and statistical distributions to create a uniform real random variable generator.
  • Creating your own RNG!

With this being said, we opt to focus the remainder of this vignette on the creation of an RNG.

Creating a Random Uniform Distribution

The basics of creating a random uniform distribution are as follows:

  1. The generation of random numbers \(R\) (e.g. 18885, 23945734, 4298034852, and so on)
  2. The known maximum/ceiling of the random number generation \(\max\left(R\right)\) (e.g. sitmo::prng::max() or SITMO_RAND_MAX)
  3. The ability to scale the randomly generated number between \([a,b]\).

sitmo provides a high quality version of 1. as shown informally in the next section and a means of acquiring 2. Thus, one is only left with creating the correct scaling equation. In particular, this equation is governed by:

\[a + \frac{R}{{MAX\left( R \right)}}\left( {b - a} \right)\]

The implementation of this using sitmo is given as follows:

To verify the quality of sitmo in an informal way, we can test the dependency or correlation between the seeds. To do so, we generate the same number of realizations under different seeds that have a range. With this being said, we consider the following code:

We can visualize the data by using a correlation graph. In this case, the generations off the diagonal should have no correlation (\(r = 0\)) whereas the seeds on the diagonal should have a correlation of 1 (\(r = 1\)).

Observing the correlation graph, we note that the pattern predicted - only correlation on the diagonal - exists. Thus, the generation under these seeds are ideal.

sitmo/inst/doc/uniform_rng_with_sitmo.R0000644000176200001440000000205413413722047020051 0ustar liggesusers## ----setup, include=FALSE------------------------------------------------ knitr::opts_chunk$set(echo = TRUE) ## ----correlation--------------------------------------------------------- # Load packages library(ggplot2) library(sitmo) # Number of Observations to Generate n = 1e6 # Number of seeds to try (1 ... S) nseeds = 30 # Storage for seed number and the correlation of the realizations between generators. cppdf = data.frame(s1 = numeric(nseeds), s2 = numeric(nseeds), cor = numeric(nseeds), stringsAsFactors = F) # Generate observations under the seeds count = 0 for(i in seq_len(nseeds)){ for(j in i:nseeds){ u1 = runif_sitmo(n, 0.0, 1.0, i) u2 = runif_sitmo(n, 0.0, 1.0, j) count = count + 1 cppdf[count,] = c(i, j, cor(u1,u2)) } } ## ----corr_plot, fig.width = 7, fig.height = 4---------------------------- # Create Correlation Plot ggplot(cppdf) + geom_tile(aes(x = s1, y = s2, fill = cor)) + xlab("Seed 1") + ylab("Seed 2") + ggtitle("Correlations between seed realizations using `sitmo`") + theme_bw() sitmo/inst/doc/big_crush_test.html0000644000176200001440000141244113413722032017025 0ustar liggesusers sitmo’s BigCrush Results

sitmo’s BigCrush Results

2019-01-04

Introduction

TestU01 is a software library produced by Pierre L’Ecuyer and Richard Simard written in C that provides a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs). The suite is able to provide information on the quality of the randomness a psuedo-random number generator can produce. It is able to do so under four different branches:

  • Implementing (pre-programmed) RNGs;
  • implementing specific statistical tests;
  • implementing batteries of statistical tests; and
  • Applying tests to entire families of RNGs.

TestU01 offers several batteries of tests including “Small Crush” (which consists of 10 tests), “Crush” (96 tests), and “Big Crush” (106 tests). With the later test being more extensive than the previous ones. For more information about the tests available, please consult the TestU01 userguide. The results of the “Big Crush” test are presented next.

Results of the Test

Running the Big Crush test from the TestU01 suite has yielded a complete pass rate (e.g “All tests were passed”) with the specifics of each of the 103 tests being detailed below.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                 Starting BigCrush
                 Version: TestU01 1.2.3
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
 
***********************************************************
Test smarsa_SerialOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Sitmos-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N =  1,  n = 1000000000,  r =  0,   d =  256,   t =  3,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =           16777216
       Expected number per cell =   59.604645
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =   0.0083558402,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          : 16711680
Value of the statistic                : 1.67e+7
p-value of test                       :    0.59
 
 
-----------------------------------------------
CPU time used                    :  00:01:04.53
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_SerialOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N =  1,  n = 1000000000,  r = 22,   d =  256,   t =  3,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =           16777216
       Expected number per cell =   59.604645
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =   0.0083558402,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          : 16711680
Value of the statistic                : 1.67e+7
p-value of test                       :    0.42
 
 
-----------------------------------------------
CPU time used                    :  00:01:08.78
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  0,   d = 2097152,   t =  2,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1445
p-value of test                       :    0.02
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334565
  j =  1                              :        599997110
  j =  2                              :             1445
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:03:49.93
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  9,   d = 2097152,   t =  2,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1294
p-value of test                       :    0.97
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334414
  j =  1                              :        599997412
  j =  2                              :             1294
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:03:44.17
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  0,   d = 16384,   t =  3,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1341
p-value of test                       :    0.73
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334461
  j =  1                              :        599997318
  j =  2                              :             1341
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:43.85
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r = 16,   d = 16384,   t =  3,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1401
p-value of test                       :    0.16
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334521
  j =  1                              :        599997198
  j =  2                              :             1401
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:38.33
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  0,   d =   64,   t =  7,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1363
p-value of test                       :    0.51
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334483
  j =  1                              :        599997274
  j =  2                              :             1363
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:45.35
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r = 24,   d =   64,   t =  7,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1312
p-value of test                       :    0.92
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334432
  j =  1                              :        599997376
  j =  2                              :             1312
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:41.50
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  0,   d =    8,   t = 14,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1373
p-value of test                       :    0.41
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334493
  j =  1                              :        599997254
  j =  2                              :             1373
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:45.18
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r = 27,   d =    8,   t = 14,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1360
p-value of test                       :    0.54
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334480
  j =  1                              :        599997280
  j =  2                              :             1360
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:41.13
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r =  0,   d =    4,   t = 21,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1355
p-value of test                       :    0.59
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334475
  j =  1                              :        599997290
  j =  2                              :             1355
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:43.98
 
Generator state:
 
 
 
 
***********************************************************
Test smarsa_CollisionOver calling smultin_MultinomialOver
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_MultinomialOver test:
-----------------------------------------------
   N = 30,  n = 20000000,  r = 28,   d =    4,   t = 21,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellSerial
       Number of cells = d^t =      4398046511104
       Expected number per cell =  1 /  219902.33
       EColl = n^2 / (2k) =  45.47473509
       Hashing =   TRUE
 
       Collision test
 
       CollisionOver:   density = n / k =  1 /  219902.33
       Expected number of collisions = Mu =      45.47
 
 
-----------------------------------------------
Results of CollisionOver test:
 
POISSON approximation                 :
Expected number of collisions = N*Mu  :     1364.24
Observed number of collisions         :     1387
p-value of test                       :    0.27
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :  131940795334507
  j =  1                              :        599997226
  j =  2                              :             1387
  j =  3                              :                0
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:39.21
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 100,  n = 10000000,  r =  0,    d = 2147483648,    t = 2,    p = 1
 
 
      Number of cells = d^t = 4611686018427387904
      Lambda = Poisson mean =      54.2101
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    5421.01
Total observed number                 :    5379
p-value of test                       :    0.71
 
 
-----------------------------------------------
CPU time used                    :  00:03:58.55
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 20000000,  r =  0,    d = 2097152,    t = 3,    p = 1
 
 
      Number of cells = d^t = 9223372036854775808
      Lambda = Poisson mean =     216.8404
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    4336.81
Total observed number                 :    4347
p-value of test                       :    0.44
 
 
-----------------------------------------------
CPU time used                    :  00:01:44.53
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 30000000,  r = 14,    d = 65536,    t = 4,    p = 1
 
 
      Number of cells = d^t = 18446744073709551616
      Lambda = Poisson mean =     365.9182
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    7318.36
Total observed number                 :    7383
p-value of test                       :    0.23
 
 
-----------------------------------------------
CPU time used                    :  00:02:48.51
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 20000000,  r =  0,    d = 512,    t = 7,    p = 1
 
 
      Number of cells = d^t = 9223372036854775808
      Lambda = Poisson mean =     216.8404
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    4336.81
Total observed number                 :    4299
p-value of test                       :    0.71
 
 
-----------------------------------------------
CPU time used                    :  00:01:59.94
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 20000000,  r =  7,    d = 512,    t = 7,    p = 1
 
 
      Number of cells = d^t = 9223372036854775808
      Lambda = Poisson mean =     216.8404
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    4336.81
Total observed number                 :    4377
p-value of test                       :    0.27
 
 
-----------------------------------------------
CPU time used                    :  00:02:05.76
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 30000000,  r = 14,    d = 256,    t = 8,    p = 1
 
 
      Number of cells = d^t = 18446744073709551616
      Lambda = Poisson mean =     365.9182
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    7318.36
Total observed number                 :    7325
p-value of test                       :    0.47
 
 
-----------------------------------------------
CPU time used                    :  00:03:19.07
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 30000000,  r = 22,    d = 256,    t = 8,    p = 1
 
 
      Number of cells = d^t = 18446744073709551616
      Lambda = Poisson mean =     365.9182
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    7318.36
Total observed number                 :    7294
p-value of test                       :    0.61
 
 
-----------------------------------------------
CPU time used                    :  00:03:19.19
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 30000000,  r =  0,    d = 16,    t = 16,    p = 1
 
 
      Number of cells = d^t = 18446744073709551616
      Lambda = Poisson mean =     365.9182
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    7318.36
Total observed number                 :    7366
p-value of test                       :    0.29
 
 
-----------------------------------------------
CPU time used                    :  00:04:00.28
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_BirthdaySpacings test:
-----------------------------------------------
   N = 20,  n = 30000000,  r = 26,    d = 16,    t = 16,    p = 1
 
 
      Number of cells = d^t = 18446744073709551616
      Lambda = Poisson mean =     365.9182
 
 
----------------------------------------------------
Total expected number = N*Lambda      :    7318.36
Total observed number                 :    7357
p-value of test                       :    0.33
 
 
-----------------------------------------------
CPU time used                    :  00:04:19.81
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
snpair_ClosePairs test:
-----------------------------------------------
   N = 30,  n = 6000000,  r =  0,  t = 3,  p = 0,  m = 30,  Torus =  TRUE
 
 
---------------------------------------
Test based on the 2 nearest points (NP):
 
Stat. AD on the N values (NP)         :    0.30
p-value of test                       :    0.93
 
 
A2 test based on the spacings between the
   successive jump times of process Y_n(t):
 
A2 test on the values of A2 (m-NP)    :    0.55
p-value of test                       :    0.69
 
Test on the Nm values of W_{n,i}(mNP1):    1.63
p-value of test                       :    0.15
 
Test on the jump times of Y
   (superposition of Yn):
 
Expected number of jumps of Y = mN    :     900
Number of jumps of Y                  :     970
p-value of test                       :    0.01
 
Stat. AD (mNP2)                       :    1.27
p-value of test                       :    0.24
 
Stat. AD after spacings (mNP2-S)      :    1.48
p-value of test                       :    0.18
 
-----------------------------------------------
CPU time used                    :  00:02:35.76
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
snpair_ClosePairs test:
-----------------------------------------------
   N = 20,  n = 4000000,  r =  0,  t = 5,  p = 0,  m = 30,  Torus =  TRUE
 
 
---------------------------------------
Test based on the 2 nearest points (NP):
 
Stat. AD on the N values (NP)         :    1.33
p-value of test                       :    0.22
 
 
A2 test based on the spacings between the
   successive jump times of process Y_n(t):
 
A2 test on the values of A2 (m-NP)    :    0.58
p-value of test                       :    0.67
 
Test on the Nm values of W_{n,i}(mNP1):    0.76
p-value of test                       :    0.51
 
Test on the jump times of Y
   (superposition of Yn):
 
Expected number of jumps of Y = mN    :     600
Number of jumps of Y                  :     577
p-value of test                       :    0.82
 
Stat. AD (mNP2)                       :    1.31
p-value of test                       :    0.23
 
Stat. AD after spacings (mNP2-S)      :    0.81
p-value of test                       :    0.48
 
-----------------------------------------------
CPU time used                    :  00:01:45.47
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
snpair_ClosePairs test:
-----------------------------------------------
   N = 10,  n = 3000000,  r =  0,  t = 9,  p = 0,  m = 30,  Torus =  TRUE
 
 
---------------------------------------
Test based on the 2 nearest points (NP):
 
Stat. AD on the N values (NP)         :    0.52
p-value of test                       :    0.73
 
 
A2 test based on the spacings between the
   successive jump times of process Y_n(t):
 
A2 test on the values of A2 (m-NP)    :    0.29
p-value of test                       :    0.94
 
Test on the Nm values of W_{n,i}(mNP1):    1.48
p-value of test                       :    0.18
 
Test on the jump times of Y
   (superposition of Yn):
 
Expected number of jumps of Y = mN    :     300
Number of jumps of Y                  :     260
p-value of test                       :    0.99
 
Stat. AD (mNP2)                       :    0.71
p-value of test                       :    0.55
 
Stat. AD after spacings (mNP2-S)      :    0.62
p-value of test                       :    0.63
 
-----------------------------------------------
CPU time used                    :  00:02:55.40
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
snpair_ClosePairs test:
-----------------------------------------------
   N =  5,  n = 2000000,  r =  0,  t = 16,  p = 0,  m = 30,  Torus =  TRUE
 
 
---------------------------------------
Test based on the 2 nearest points (NP):
 
Stat. AD on the N values (NP)         :    1.24
p-value of test                       :    0.25
 
 
A2 test based on the spacings between the
   successive jump times of process Y_n(t):
 
A2 test on the values of A2 (m-NP)    :    0.54
p-value of test                       :    0.70
 
Test on the Nm values of W_{n,i}(mNP1):    1.31
p-value of test                       :    0.23
 
Test on the jump times of Y
   (superposition of Yn):
 
Expected number of jumps of Y = mN    :     150
Number of jumps of Y                  :     150
p-value of test                       :    0.51
 
Stat. AD (mNP2)                       :    3.70
p-value of test                       :    0.01
 
Stat. AD after spacings (mNP2-S)      :    0.89
p-value of test                       :    0.42
 
-----------------------------------------------
CPU time used                    :  00:03:22.78
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_SimpPoker test:
-----------------------------------------------
   N =  1,  n = 400000000,  r =  0,   d =    8,   k =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :    7
Chi-square statistic                  :    5.92
p-value of test                       :    0.55
 
-----------------------------------------------
CPU time used                    :  00:00:59.10
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_SimpPoker test:
-----------------------------------------------
   N =  1,  n = 400000000,  r = 27,   d =    8,   k =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :    7
Chi-square statistic                  :    3.46
p-value of test                       :    0.84
 
-----------------------------------------------
CPU time used                    :  00:01:09.35
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_SimpPoker test:
-----------------------------------------------
   N =  1,  n = 100000000,  r =  0,   d =   32,   k =   32
 
 
-----------------------------------------------
Number of degrees of freedom          :   18
Chi-square statistic                  :    9.52
p-value of test                       :    0.95
 
-----------------------------------------------
CPU time used                    :  00:01:02.60
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_SimpPoker test:
-----------------------------------------------
   N =  1,  n = 100000000,  r = 25,   d =   32,   k =   32
 
 
-----------------------------------------------
Number of degrees of freedom          :   18
Chi-square statistic                  :   14.29
p-value of test                       :    0.71
 
-----------------------------------------------
CPU time used                    :  00:01:13.81
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_CouponCollector test:
-----------------------------------------------
   N =  1,  n = 200000000,  r =  0,   d =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :   54
Chi-square statistic                  :   44.18
p-value of test                       :    0.83
 
-----------------------------------------------
CPU time used                    :  00:01:16.02
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_CouponCollector test:
-----------------------------------------------
   N =  1,  n = 200000000,  r = 10,   d =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :   54
Chi-square statistic                  :   47.86
p-value of test                       :    0.71
 
-----------------------------------------------
CPU time used                    :  00:01:28.55
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_CouponCollector test:
-----------------------------------------------
   N =  1,  n = 200000000,  r = 20,   d =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :   54
Chi-square statistic                  :   50.86
p-value of test                       :    0.60
 
-----------------------------------------------
CPU time used                    :  00:01:28.60
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_CouponCollector test:
-----------------------------------------------
   N =  1,  n = 200000000,  r = 27,   d =    8
 
 
-----------------------------------------------
Number of degrees of freedom          :   54
Chi-square statistic                  :   58.93
p-value of test                       :    0.30
 
-----------------------------------------------
CPU time used                    :  00:01:28.68
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Gap test:
-----------------------------------------------
   N =  1,  n = 500000000,  r =  0,   Alpha =        0,   Beta  =   0.0625
 
 
-----------------------------------------------
Number of degrees of freedom          :  232
Chi-square statistic                  :  214.26
p-value of test                       :    0.79
 
-----------------------------------------------
CPU time used                    :  00:01:32.96
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Gap test:
-----------------------------------------------
   N =  1,  n = 300000000,  r = 25,   Alpha =        0,   Beta  =  0.03125
 
 
-----------------------------------------------
Number of degrees of freedom          :  434
Chi-square statistic                  :  397.76
p-value of test                       :    0.89
 
-----------------------------------------------
CPU time used                    :  00:02:06.14
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Gap test:
-----------------------------------------------
   N =  1,  n = 100000000,  r =  0,   Alpha =        0,   Beta  = 0.0078125
 
 
-----------------------------------------------
Number of degrees of freedom          : 1437
Chi-square statistic                  : 1481.41
p-value of test                       :    0.20
 
-----------------------------------------------
CPU time used                    :  00:02:13.51
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Gap test:
-----------------------------------------------
   N =  1,  n = 10000000,  r = 20,   Alpha =        0,   Beta  = 0.000976562
 
 
-----------------------------------------------
Number of degrees of freedom          : 7046
Chi-square statistic                  : 7166.64
p-value of test                       :    0.15
 
-----------------------------------------------
CPU time used                    :  00:02:08.09
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Run test:
-----------------------------------------------
   N =  5,  n = 1000000000,  r =  0,   Up = FALSE
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.50
p-value of test                       :    0.05
 
Kolmogorov-Smirnov- statistic = D-    :    0.14
p-value of test                       :    0.77
 
Anderson-Darling statistic = A2       :    2.25
p-value of test                       :    0.07
 
Test on the sum of all N observations
Number of degrees of freedom          :   30
Chi-square statistic                  :   22.54
p-value of test                       :    0.83
 
-----------------------------------------------
CPU time used                    :  00:01:23.93
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_Run test:
-----------------------------------------------
   N = 10,  n = 1000000000,  r = 15,   Up =  TRUE
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.21
p-value of test                       :    0.35
 
Kolmogorov-Smirnov- statistic = D-    :    0.15
p-value of test                       :    0.59
 
Anderson-Darling statistic = A2       :    0.50
p-value of test                       :    0.75
 
Test on the sum of all N observations
Number of degrees of freedom          :   60
Chi-square statistic                  :   58.53
p-value of test                       :    0.53
 
-----------------------------------------------
CPU time used                    :  00:03:11.42
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_Permutation calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N =  1,  n = 1000000000,  r =  5,   t =  3,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =                  6
       Expected number per cell =  1.6666667e+08
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =  2.5000002e-09,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          :    5
Value of the statistic                :    8.17
p-value of test                       :    0.15
 
 
-----------------------------------------------
CPU time used                    :  00:00:46.93
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_Permutation calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N =  1,  n = 1000000000,  r =  5,   t =  5,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =                120
       Expected number per cell =   8333333.3
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =  5.9500005e-08,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          :  119
Value of the statistic                :  108.58
p-value of test                       :    0.74
 
 
-----------------------------------------------
CPU time used                    :  00:01:35.02
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_Permutation calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N =  1,  n = 500000000,  r =  5,   t =  7,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =               5040
       Expected number per cell =   99206.349
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =  5.0390004e-06,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          : 5039
Value of the statistic                : 4810.30
p-value of test                       :    0.99
 
 
-----------------------------------------------
CPU time used                    :  00:01:24.63
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_Permutation calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N =  1,  n = 500000000,  r = 10,   t = 10,
       Sparse =  FALSE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =            3628800
       Expected number per cell =    137.7866
       Hashing =  FALSE
 
   For Delta > -1, we use the ChiSquare approximation
   Correction factor of the ChiSquare: 
       Delta =     1,    Mu =   0.0036287993,    Sigma =          1
 
-----------------------------------------------
Test Results for Delta =   1.0000
 
Number of degrees of freedom          : 3628799
Value of the statistic                : 3.63e+6
p-value of test                       :    0.80
 
 
-----------------------------------------------
CPU time used                    :  00:03:06.50
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_CollisionPermut calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N = 20,  n = 20000000,  r =  0,   t = 14,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =        87178291200
       Expected number per cell =  1 /  4358.9146
       EColl = n^2 / (2k) =   2294.14912
       Hashing =   TRUE
 
       Collision test,    Mu =      2293.9736,    Sigma =    47.8841
 
-----------------------------------------------
Test Results for Collisions
 
For the total number of collisions, we use
      the Poisson approximation:
Expected number of collisions = N*Mu  :    45879.47
Observed number of collisions         :    45892
p-value of test                       :    0.48
 
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :    1743165869892
  j =  1                              :        399908218
  j =  2                              :            45888
  j =  3                              :                2
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:04:54.47
 
Generator state:
 
 
 
 
***********************************************************
Test sknuth_CollisionPermut calling smultin_Multinomial
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smultin_Multinomial test:
-----------------------------------------------
   N = 20,  n = 20000000,  r = 10,   t = 14,
       Sparse =   TRUE
 
       GenerCell = smultin_GenerCellPermut
       Number of cells = t! =        87178291200
       Expected number per cell =  1 /  4358.9146
       EColl = n^2 / (2k) =   2294.14912
       Hashing =   TRUE
 
       Collision test,    Mu =      2293.9736,    Sigma =    47.8841
 
-----------------------------------------------
Test Results for Collisions
 
For the total number of collisions, we use
      the Poisson approximation:
Expected number of collisions = N*Mu  :    45879.47
Observed number of collisions         :    45960
p-value of test                       :    0.35
 
 
-----------------------------
Total number of cells containing j balls
 
  j =  0                              :    1743165869960
  j =  1                              :        399908084
  j =  2                              :            45952
  j =  3                              :                4
  j =  4                              :                0
  j =  5                              :                0
 
-----------------------------------------------
CPU time used                    :  00:05:01.14
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_MaxOft test:
-----------------------------------------------
   N = 40,  n = 10000000,  r =  0,   d = 100000,   t =  8
 
      Number of categories = 100000
      Expected number per category  = 100.00
 
 
-----------------------------------------------
Test results for chi2 with 99999 degrees of freedom:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.11
p-value of test                       :    0.35
 
Kolmogorov-Smirnov- statistic = D-    :   0.036
p-value of test                       :    0.88
 
Anderson-Darling statistic = A2       :    0.61
p-value of test                       :    0.64
 
Test on the sum of all N observations
Number of degrees of freedom          : 3999960
Chi-square statistic                  : 4.00e+6
p-value of test                       :    0.77
 
 
-----------------------------------------------
Test results for Anderson-Darling:
 
Kolmogorov-Smirnov+ statistic = D+    :   0.091
p-value of test                       :    0.49
 
Kolmogorov-Smirnov- statistic = D-    :   0.054
p-value of test                       :    0.77
 
Anderson-Darling statistic = A2       :    0.41
p-value of test                       :    0.84
 
 
-----------------------------------------------
CPU time used                    :  00:01:45.23
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_MaxOft test:
-----------------------------------------------
   N = 30,  n = 10000000,  r =  0,   d = 100000,   t = 16
 
      Number of categories = 100000
      Expected number per category  = 100.00
 
 
-----------------------------------------------
Test results for chi2 with 99999 degrees of freedom:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.13
p-value of test                       :    0.32
 
Kolmogorov-Smirnov- statistic = D-    :    0.17
p-value of test                       :    0.17
 
Anderson-Darling statistic = A2       :    1.26
p-value of test                       :    0.25
 
Test on the sum of all N observations
Number of degrees of freedom          : 2999970
Chi-square statistic                  : 3.00e+6
p-value of test                       :    0.40
 
 
-----------------------------------------------
Test results for Anderson-Darling:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.19
p-value of test                       :    0.11
 
Kolmogorov-Smirnov- statistic = D-    :   0.014
p-value of test                       :    0.98
 
Anderson-Darling statistic = A2       :    1.61
p-value of test                       :    0.15
 
 
-----------------------------------------------
CPU time used                    :  00:01:43.48
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_MaxOft test:
-----------------------------------------------
   N = 20,  n = 10000000,  r =  0,   d = 100000,   t = 24
 
      Number of categories = 100000
      Expected number per category  = 100.00
 
 
-----------------------------------------------
Test results for chi2 with 99999 degrees of freedom:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.15
p-value of test                       :    0.38
 
Kolmogorov-Smirnov- statistic = D-    :    0.12
p-value of test                       :    0.54
 
Anderson-Darling statistic = A2       :    0.55
p-value of test                       :    0.69
 
Test on the sum of all N observations
Number of degrees of freedom          : 1999980
Chi-square statistic                  : 2.00e+6
p-value of test                       :    0.64
 
 
-----------------------------------------------
Test results for Anderson-Darling:
 
Kolmogorov-Smirnov+ statistic = D+    :   0.040
p-value of test                       :    0.91
 
Kolmogorov-Smirnov- statistic = D-    :    0.19
p-value of test                       :    0.23
 
Anderson-Darling statistic = A2       :    0.94
p-value of test                       :    0.39
 
 
-----------------------------------------------
CPU time used                    :  00:01:27.73
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sknuth_MaxOft test:
-----------------------------------------------
   N = 20,  n = 10000000,  r =  0,   d = 100000,   t = 32
 
      Number of categories = 100000
      Expected number per category  = 100.00
 
 
-----------------------------------------------
Test results for chi2 with 99999 degrees of freedom:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.12
p-value of test                       :    0.51
 
Kolmogorov-Smirnov- statistic = D-    :   0.100
p-value of test                       :    0.63
 
Anderson-Darling statistic = A2       :    0.49
p-value of test                       :    0.75
 
Test on the sum of all N observations
Number of degrees of freedom          : 1999980
Chi-square statistic                  : 2.00e+6
p-value of test                       :    0.64
 
 
-----------------------------------------------
Test results for Anderson-Darling:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.10
p-value of test                       :    0.61
 
Kolmogorov-Smirnov- statistic = D-    :    0.16
p-value of test                       :    0.33
 
Anderson-Darling statistic = A2       :    0.79
p-value of test                       :    0.48
 
 
-----------------------------------------------
CPU time used                    :  00:01:43.31
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleProd test:
-----------------------------------------------
   N = 40,  n = 10000000,  r =  0,   t = 8
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.18
p-value of test                       :    0.06
 
Kolmogorov-Smirnov- statistic = D-    :   0.049
p-value of test                       :    0.80
 
Anderson-Darling statistic = A2       :    1.90
p-value of test                       :    0.10
 
-----------------------------------------------
CPU time used                    :  00:01:54.64
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleProd test:
-----------------------------------------------
   N = 20,  n = 10000000,  r =  0,   t = 16
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.24
p-value of test                       :    0.08
 
Kolmogorov-Smirnov- statistic = D-    :   0.043
p-value of test                       :    0.90
 
Anderson-Darling statistic = A2       :    2.22
p-value of test                       :    0.07
 
-----------------------------------------------
CPU time used                    :  00:01:29.65
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleProd test:
-----------------------------------------------
   N = 20,  n = 10000000,  r =  0,   t = 24
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.23
p-value of test                       :    0.10
 
Kolmogorov-Smirnov- statistic = D-    :   0.012
p-value of test                       :    0.98
 
Anderson-Darling statistic = A2       :    1.69
p-value of test                       :    0.14
 
-----------------------------------------------
CPU time used                    :  00:02:04.43
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleMean test:
-----------------------------------------------
   N = 20000000,  n = 30,  r =  0
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    : 1.93e-4
p-value of test                       :    0.22
 
Kolmogorov-Smirnov- statistic = D-    : 7.01e-5
p-value of test                       :    0.82
 
Anderson-Darling statistic = A2       :    0.50
p-value of test                       :    0.74
 
-----------------------------------------------
CPU time used                    :  00:00:15.09
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleMean test:
-----------------------------------------------
   N = 20000000,  n = 30,  r = 10
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    : 1.37e-4
p-value of test                       :    0.47
 
Kolmogorov-Smirnov- statistic = D-    : 1.31e-4
p-value of test                       :    0.50
 
Anderson-Darling statistic = A2       :    0.49
p-value of test                       :    0.76
 
-----------------------------------------------
CPU time used                    :  00:00:15.52
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleCorr test:
-----------------------------------------------
   N =  1,  n = 2000000000,  r =  0,   k = 1
 
 
-----------------------------------------------
Normal statistic                      :   -1.75
p-value of test                       :    0.96
 
-----------------------------------------------
CPU time used                    :  00:00:23.87
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SampleCorr test:
-----------------------------------------------
   N =  1,  n = 2000000000,  r =  0,   k = 2
 
 
-----------------------------------------------
Normal statistic                      :    1.09
p-value of test                       :    0.14
 
-----------------------------------------------
CPU time used                    :  00:00:23.96
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_AppearanceSpacings test:
-----------------------------------------------
   N =  1,   Q = 10000000,   K = 1000000000,   r = 0,   s = 3,   L = 15
 
   Sequences of n = (K + Q)L =  15150000000 bits
   Q = 10000000 initialization blocks
   K = 1000000000 blocks for the test
   the blocks have L = 15 bits
 
 
 
-----------------------------------------------
Normal statistic                      :   -0.31
p-value of test                       :    0.62
 
-----------------------------------------------
CPU time used                    :  00:01:09.11
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_AppearanceSpacings test:
-----------------------------------------------
   N =  1,   Q = 10000000,   K = 1000000000,   r = 27,   s = 3,   L = 15
 
   Sequences of n = (K + Q)L =  15150000000 bits
   Q = 10000000 initialization blocks
   K = 1000000000 blocks for the test
   the blocks have L = 15 bits
 
 
 
-----------------------------------------------
Normal statistic                      :   -0.77
p-value of test                       :    0.78
 
-----------------------------------------------
CPU time used                    :  00:01:12.02
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r =  0,  k = 256,  Alpha =      0,  Beta =   0.25
 
 
-----------------------------------------------
Number of degrees of freedom          :   67
Chi-square statistic                  :   53.51
p-value of test                       :    0.88
 
-----------------------------------------------
CPU time used                    :  00:00:53.06
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r = 20,  k = 256,  Alpha =      0,  Beta =   0.25
 
 
-----------------------------------------------
Number of degrees of freedom          :   67
Chi-square statistic                  :   76.46
p-value of test                       :    0.20
 
-----------------------------------------------
CPU time used                    :  00:01:05.73
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r = 28,  k = 256,  Alpha =      0,  Beta =   0.25
 
 
-----------------------------------------------
Number of degrees of freedom          :   67
Chi-square statistic                  :   66.46
p-value of test                       :    0.50
 
-----------------------------------------------
CPU time used                    :  00:01:05.79
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r =  0,  k = 256,  Alpha =      0,  Beta = 0.0625
 
 
-----------------------------------------------
Number of degrees of freedom          :   37
Chi-square statistic                  :   32.57
p-value of test                       :    0.68
 
-----------------------------------------------
CPU time used                    :  00:00:53.05
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r = 10,  k = 256,  Alpha =      0,  Beta = 0.0625
 
 
-----------------------------------------------
Number of degrees of freedom          :   37
Chi-square statistic                  :   53.95
p-value of test                       :    0.04
 
-----------------------------------------------
CPU time used                    :  00:01:05.79
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_WeightDistrib test:
-----------------------------------------------
   N =  1,  n = 20000000,  r = 26,  k = 256,  Alpha =      0,  Beta = 0.0625
 
 
-----------------------------------------------
Number of degrees of freedom          :   37
Chi-square statistic                  :   18.95
p-value of test                       :    0.9939
 
-----------------------------------------------
CPU time used                    :  00:01:05.73
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
svaria_SumCollector test:
-----------------------------------------------
   N =  1,  n = 500000000,  r =  0,   g = 10
 
 
-----------------------------------------------
Number of degrees of freedom          :   29
Chi-square statistic                  :   22.00
p-value of test                       :    0.82
 
-----------------------------------------------
CPU time used                    :  00:01:58.36
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N = 10,  n = 1000000,  r =  0,    s = 5,    L = 30,    k = 30
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.27
p-value of test                       :    0.19
 
Kolmogorov-Smirnov- statistic = D-    :    0.16
p-value of test                       :    0.56
 
Anderson-Darling statistic = A2       :    0.78
p-value of test                       :    0.50
 
Test on the sum of all N observations
Number of degrees of freedom          :   40
Chi-square statistic                  :   32.66
p-value of test                       :    0.79
 
-----------------------------------------------
CPU time used                    :  00:01:16.26
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N = 10,  n = 1000000,  r = 25,    s = 5,    L = 30,    k = 30
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.19
p-value of test                       :    0.42
 
Kolmogorov-Smirnov- statistic = D-    :    0.14
p-value of test                       :    0.62
 
Anderson-Darling statistic = A2       :    0.49
p-value of test                       :    0.75
 
Test on the sum of all N observations
Number of degrees of freedom          :   40
Chi-square statistic                  :   34.46
p-value of test                       :    0.72
 
-----------------------------------------------
CPU time used                    :  00:01:16.23
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N =  1,  n = 5000,  r =  0,    s = 4,    L = 1000,    k = 1000
 
 
-----------------------------------------------
Number of degrees of freedom          :    3
Chi-square statistic                  :    0.73
p-value of test                       :    0.87
 
-----------------------------------------------
CPU time used                    :  00:03:44.79
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N =  1,  n = 5000,  r = 26,    s = 4,    L = 1000,    k = 1000
 
 
-----------------------------------------------
Number of degrees of freedom          :    3
Chi-square statistic                  :    1.12
p-value of test                       :    0.77
 
-----------------------------------------------
CPU time used                    :  00:03:44.77
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N =  1,  n = 80,  r = 15,    s = 15,    L = 5000,    k = 5000
 
 
-----------------------------------------------
Number of degrees of freedom          :    2
Chi-square statistic                  :    6.04
p-value of test                       :    0.05
 
-----------------------------------------------
CPU time used                    :  00:03:28.23
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_MatrixRank test:
-----------------------------------------------
   N =  1,  n = 80,  r =  0,    s = 30,    L = 5000,    k = 5000
 
 
-----------------------------------------------
Number of degrees of freedom          :    2
Chi-square statistic                  :   0.075
p-value of test                       :    0.96
 
-----------------------------------------------
CPU time used                    :  00:02:51.20
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_Savir2 test:
-----------------------------------------------
   N = 10,  n = 10000000,  r = 10,    m = 1048576,    t = 30
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :   0.027
p-value of test                       :    0.97
 
Kolmogorov-Smirnov- statistic = D-    :    0.41
p-value of test                       :    0.02
 
Anderson-Darling statistic = A2       :    2.58
p-value of test                       :    0.05
 
Test on the sum of all N observations
Number of degrees of freedom          :  130
Chi-square statistic                  :  164.06
p-value of test                       :    0.02
 
-----------------------------------------------
CPU time used                    :  00:00:37.67
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
smarsa_GCD test:
-----------------------------------------------
   N = 10,  n = 50000000,  r =  0,   s = 30
 
 
-----------------------------------------------
Test results for GCD values:
 
Kolmogorov-Smirnov+ statistic = D+    :    0.34
p-value of test                       :    0.08
 
Kolmogorov-Smirnov- statistic = D-    :   0.026
p-value of test                       :    0.97
 
Anderson-Darling statistic = A2       :    1.62
p-value of test                       :    0.15
 
Test on the sum of all N observations
Number of degrees of freedom          : 17430
Chi-square statistic                  :17122.72
p-value of test                       :    0.95
 
 
 
-----------------------------------------------
CPU time used                    :  00:01:54.05
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 100000000,  r =  0,   s = 5,   L0 =   50,   L1 =   50
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :   36
ChiSquare statistic                   :   30.27
p-value of test                       :    0.74
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :   35
ChiSquare statistic                   :   34.79
p-value of test                       :    0.48
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          :   25
ChiSquare statistic                   :   34.88
p-value of test                       :    0.09
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :   24
ChiSquare statistic                   :   25.02
p-value of test                       :    0.40
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :   17
ChiSquare statistic                   :   24.18
p-value of test                       :    0.11
 
 
-----------------------------------------------
CPU time used                    :  00:00:47.70
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 100000000,  r = 25,   s = 5,   L0 =   50,   L1 =   50
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :   36
ChiSquare statistic                   :   26.87
p-value of test                       :    0.86
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :   35
ChiSquare statistic                   :   25.33
p-value of test                       :    0.89
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          :   25
ChiSquare statistic                   :   40.08
p-value of test                       :    0.03
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :   24
ChiSquare statistic                   :   19.29
p-value of test                       :    0.74
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :   17
ChiSquare statistic                   :   11.45
p-value of test                       :    0.83
 
 
-----------------------------------------------
CPU time used                    :  00:00:48.73
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 10000000,  r =  0,   s = 10,   L0 = 1000,   L1 = 1000
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :  146
ChiSquare statistic                   :  177.55
p-value of test                       :    0.04
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :  146
ChiSquare statistic                   :  117.36
p-value of test                       :    0.96
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          :  500
ChiSquare statistic                   :  438.13
p-value of test                       :    0.98
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :  136
ChiSquare statistic                   :  119.76
p-value of test                       :    0.84
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :   74
ChiSquare statistic                   :   86.45
p-value of test                       :    0.15
 
 
-----------------------------------------------
CPU time used                    :  00:01:06.36
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 10000000,  r = 20,   s = 10,   L0 = 1000,   L1 = 1000
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :  146
ChiSquare statistic                   :  128.52
p-value of test                       :    0.85
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :  146
ChiSquare statistic                   :  139.85
p-value of test                       :    0.63
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          :  500
ChiSquare statistic                   :  509.00
p-value of test                       :    0.38
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :  136
ChiSquare statistic                   :  125.25
p-value of test                       :    0.74
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :   74
ChiSquare statistic                   :   68.45
p-value of test                       :    0.66
 
 
-----------------------------------------------
CPU time used                    :  00:01:08.10
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 1000000,  r =  0,   s = 15,   L0 = 10000,   L1 = 10000
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :  384
ChiSquare statistic                   :  396.65
p-value of test                       :    0.32
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :  384
ChiSquare statistic                   :  387.98
p-value of test                       :    0.43
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          : 5000
ChiSquare statistic                   : 4987.07
p-value of test                       :    0.55
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :  378
ChiSquare statistic                   :  370.70
p-value of test                       :    0.60
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :  200
ChiSquare statistic                   :  202.48
p-value of test                       :    0.44
 
 
-----------------------------------------------
CPU time used                    :  00:00:57.94
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
swalk_RandomWalk1 test:
-----------------------------------------------
   N =  1,  n = 1000000,  r = 15,   s = 15,   L0 = 10000,   L1 = 10000
 
 
 
-----------------------------------------------
Test on the values of the Statistic H
 
Number of degrees of freedom          :  384
ChiSquare statistic                   :  370.10
p-value of test                       :    0.69
 
 
-----------------------------------------------
Test on the values of the Statistic M
 
Number of degrees of freedom          :  384
ChiSquare statistic                   :  369.10
p-value of test                       :    0.70
 
 
-----------------------------------------------
Test on the values of the Statistic J
 
Number of degrees of freedom          : 5000
ChiSquare statistic                   : 4890.41
p-value of test                       :    0.86
 
 
-----------------------------------------------
Test on the values of the Statistic R
 
Number of degrees of freedom          :  378
ChiSquare statistic                   :  357.68
p-value of test                       :    0.77
 
 
-----------------------------------------------
Test on the values of the Statistic C
 
Number of degrees of freedom          :  200
ChiSquare statistic                   :  180.54
p-value of test                       :    0.83
 
 
-----------------------------------------------
CPU time used                    :  00:00:58.79
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
scomp_LinearComp test:
-----------------------------------------------
   N =  1,  n = 400020,  r =  0,    s = 1
 
 
 
-----------------------------------------------
Number of degrees of freedom          :   12
Chi2 statistic for size of jumps      :   12.60
p-value of test                       :    0.40
 
 
-----------------------------------------------
Normal statistic for number of jumps  :    2.51
p-value of test                       :  6.1e-3
 
 
 
-----------------------------------------------
CPU time used                    :  00:02:43.68
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
scomp_LinearComp test:
-----------------------------------------------
   N =  1,  n = 400020,  r = 29,    s = 1
 
 
 
-----------------------------------------------
Number of degrees of freedom          :   12
Chi2 statistic for size of jumps      :    8.18
p-value of test                       :    0.77
 
 
-----------------------------------------------
Normal statistic for number of jumps  :   -1.55
p-value of test                       :    0.94
 
 
 
-----------------------------------------------
CPU time used                    :  00:02:43.05
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
scomp_LempelZiv test:
-----------------------------------------------
   N = 10,  n = 134217728,  r =  0,   s =   30,   k =   27
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.23
p-value of test                       :    0.31
 
Kolmogorov-Smirnov- statistic = D-    :    0.13
p-value of test                       :    0.65
 
Anderson-Darling statistic = A2       :    0.54
p-value of test                       :    0.70
 
Tests on the sum of all N observations
Standardized normal statistic         :   -0.32
p-value of test                       :    0.63
 
Sample variance                       :    1.17
p-value of test                       :    0.31
 
-----------------------------------------------
CPU time used                    :  00:00:54.70
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
scomp_LempelZiv test:
-----------------------------------------------
   N = 10,  n = 134217728,  r = 15,   s =   15,   k =   27
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.20
p-value of test                       :    0.40
 
Kolmogorov-Smirnov- statistic = D-    :   0.015
p-value of test                       :    0.98
 
Anderson-Darling statistic = A2       :    0.73
p-value of test                       :    0.53
 
Tests on the sum of all N observations
Standardized normal statistic         :   -1.20
p-value of test                       :    0.88
 
Sample variance                       :    0.89
p-value of test                       :    0.53
 
-----------------------------------------------
CPU time used                    :  00:00:55.27
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sspectral_Fourier3 test:
-----------------------------------------------
   N = 100000,  n = 16384,  r =  0,   s =    3,   k =   14
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :   0.021
p-value of test                       :    0.02
 
Kolmogorov-Smirnov- statistic = D-    : 9.76e-3
p-value of test                       :    0.46
 
Anderson-Darling statistic = A2       :    2.29
p-value of test                       :    0.06
 
-----------------------------------------------
CPU time used                    :  00:00:39.04
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sspectral_Fourier3 test:
-----------------------------------------------
   N = 100000,  n = 16384,  r = 27,   s =    3,   k =   14
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :   0.016
p-value of test                       :    0.11
 
Kolmogorov-Smirnov- statistic = D-    : 4.76e-3
p-value of test                       :    0.83
 
Anderson-Darling statistic = A2       :    1.57
p-value of test                       :    0.16
 
-----------------------------------------------
CPU time used                    :  00:00:39.54
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_LongestHeadRun test:
-----------------------------------------------
   N =  1,  n = 1000,  r =  0,   s = 3,   L = 10000020
 
 
-----------------------------------------------
Number of degrees of freedom          :    8
Chi-square statistic                  :    9.12
p-value of test                       :    0.33
 
-----------------------------------------------
Global longest run of 1               :   35.00
p-value of test                       :    0.14
 
 
 
-----------------------------------------------
CPU time used                    :  00:01:47.05
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_LongestHeadRun test:
-----------------------------------------------
   N =  1,  n = 1000,  r = 27,   s = 3,   L = 10000020
 
 
-----------------------------------------------
Number of degrees of freedom          :    8
Chi-square statistic                  :    4.78
p-value of test                       :    0.78
 
-----------------------------------------------
Global longest run of 1               :   35.00
p-value of test                       :    0.14
 
 
 
-----------------------------------------------
CPU time used                    :  00:01:50.10
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_PeriodsInStrings test:
-----------------------------------------------
   N = 10,  n = 500000000,  r =  0,   s =   10
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.30
p-value of test                       :    0.13
 
Kolmogorov-Smirnov- statistic = D-    :    0.13
p-value of test                       :    0.68
 
Anderson-Darling statistic = A2       :    0.84
p-value of test                       :    0.45
 
Test on the sum of all N observations
Number of degrees of freedom          :  200
Chi-square statistic                  :  183.59
p-value of test                       :    0.79
 
-----------------------------------------------
CPU time used                    :  00:02:51.45
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_PeriodsInStrings test:
-----------------------------------------------
   N = 10,  n = 500000000,  r = 20,   s =   10
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.25
p-value of test                       :    0.25
 
Kolmogorov-Smirnov- statistic = D-    :    0.17
p-value of test                       :    0.51
 
Anderson-Darling statistic = A2       :    0.50
p-value of test                       :    0.74
 
Test on the sum of all N observations
Number of degrees of freedom          :  200
Chi-square statistic                  :  195.89
p-value of test                       :    0.57
 
-----------------------------------------------
CPU time used                    :  00:02:56.45
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingWeight2 test:
-----------------------------------------------
   N = 10,  n = 1000000000,  r =  0,   s = 3,   L = 1000000
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.15
p-value of test                       :    0.57
 
Kolmogorov-Smirnov- statistic = D-    :    0.19
p-value of test                       :    0.43
 
Anderson-Darling statistic = A2       :    1.02
p-value of test                       :    0.34
 
Test on the sum of all N observations
Number of degrees of freedom          : 10000
Chi-square statistic                  :10157.86
p-value of test                       :    0.13
 
-----------------------------------------------
CPU time used                    :  00:00:57.75
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingWeight2 test:
-----------------------------------------------
   N = 10,  n = 1000000000,  r = 27,   s = 3,   L = 1000000
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.18
p-value of test                       :    0.48
 
Kolmogorov-Smirnov- statistic = D-    :    0.38
p-value of test                       :    0.04
 
Anderson-Darling statistic = A2       :    1.47
p-value of test                       :    0.18
 
Test on the sum of all N observations
Number of degrees of freedom          : 10000
Chi-square statistic                  :10121.19
p-value of test                       :    0.20
 
-----------------------------------------------
CPU time used                    :  00:01:01.20
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingCorr test:
-----------------------------------------------
   N =  1,  n = 1000000000,  r = 10,   s = 10,   L = 30
 
 
 
-----------------------------------------------
Normal statistic                      :    1.36
p-value of test                       :    0.09
 
-----------------------------------------------
CPU time used                    :  00:01:13.01
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingCorr test:
-----------------------------------------------
   N =  1,  n = 100000000,  r = 10,   s = 10,   L = 300
 
 
 
-----------------------------------------------
Normal statistic                      :    0.36
p-value of test                       :    0.36
 
-----------------------------------------------
CPU time used                    :  00:01:09.29
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingCorr test:
-----------------------------------------------
   N =  1,  n = 100000000,  r = 10,   s = 10,   L = 1200
 
 
 
-----------------------------------------------
Normal statistic                      :   -0.12
p-value of test                       :    0.55
 
-----------------------------------------------
CPU time used                    :  00:04:34.86
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N = 10,  n = 30000000,  r =  0,   s = 3,   L = 30,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.24
p-value of test                       :    0.28
 
Kolmogorov-Smirnov- statistic = D-    :    0.13
p-value of test                       :    0.65
 
Anderson-Darling statistic = A2       :    0.74
p-value of test                       :    0.53
 
Test on the sum of all N observations
Number of degrees of freedom          : 4890
Chi-square statistic                  : 4850.28
p-value of test                       :    0.65
 
-----------------------------------------------
CPU time used                    :  00:01:53.80
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N = 10,  n = 30000000,  r = 27,   s = 3,   L = 30,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.25
p-value of test                       :    0.24
 
Kolmogorov-Smirnov- statistic = D-    :    0.11
p-value of test                       :    0.74
 
Anderson-Darling statistic = A2       :    0.66
p-value of test                       :    0.59
 
Test on the sum of all N observations
Number of degrees of freedom          : 4890
Chi-square statistic                  : 4816.01
p-value of test                       :    0.77
 
-----------------------------------------------
CPU time used                    :  00:01:59.57
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N =  1,  n = 30000000,  r =  0,   s = 4,   L = 300,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
Number of degrees of freedom          : 4117
Chi-square statistic                  : 4183.44
p-value of test                       :    0.23
 
-----------------------------------------------
CPU time used                    :  00:01:25.02
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N =  1,  n = 30000000,  r = 26,   s = 4,   L = 300,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
Number of degrees of freedom          : 4117
Chi-square statistic                  : 4147.28
p-value of test                       :    0.37
 
-----------------------------------------------
CPU time used                    :  00:01:29.27
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N =  1,  n = 10000000,  r =  0,   s = 5,   L = 1200,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
Number of degrees of freedom          : 11825
Chi-square statistic                  :11803.57
p-value of test                       :    0.55
 
-----------------------------------------------
CPU time used                    :  00:01:33.79
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_HammingIndep test:
-----------------------------------------------
   N =  1,  n = 10000000,  r = 25,   s = 5,   L = 1200,   d = 0
 
 
 
Counters with expected numbers >= 10
-----------------------------------------------
Number of degrees of freedom          : 11825
Chi-square statistic                  :11791.39
p-value of test                       :    0.58
 
-----------------------------------------------
CPU time used                    :  00:01:38.25
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_Run test:
-----------------------------------------------
   N =  1,  n = 2000000000,  r =  0,   s =    3
 
 
-----------------------------------------------
Total number of 1 runs:  2000000000
 
Number of degrees of freedom          :   54
Chi2 statistic for number of runs     :   62.56
p-value of test                       :    0.20
 
 
-----------------------------------------------
Total number of bits:  7999957470
 
Normal statistic for number of bits   :   -0.34
p-value of test                       :    0.63
 
 
 
-----------------------------------------------
CPU time used                    :  00:01:16.00
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_Run test:
-----------------------------------------------
   N =  1,  n = 2000000000,  r = 27,   s =    3
 
 
-----------------------------------------------
Total number of 1 runs:  2000000000
 
Number of degrees of freedom          :   54
Chi2 statistic for number of runs     :   65.11
p-value of test                       :    0.14
 
 
-----------------------------------------------
Total number of bits:  7999956321
 
Normal statistic for number of bits   :   -0.35
p-value of test                       :    0.64
 
 
 
-----------------------------------------------
CPU time used                    :  00:01:18.57
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_AutoCor test:
-----------------------------------------------
   N = 10,  n = 1000000030,  r =  0,   s = 3,   d = 1
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.28
p-value of test                       :    0.18
 
Kolmogorov-Smirnov- statistic = D-    :    0.10
p-value of test                       :    0.76
 
Anderson-Darling statistic = A2       :    0.50
p-value of test                       :    0.74
 
Tests on the sum of all N observations
Standardized normal statistic         :   -0.51
p-value of test                       :    0.69
 
Sample variance                       :    0.71
p-value of test                       :    0.70
 
-----------------------------------------------
CPU time used                    :  00:02:49.27
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_AutoCor test:
-----------------------------------------------
   N = 10,  n = 1000000029,  r =  0,   s = 3,   d = 3
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :    0.13
p-value of test                       :    0.66
 
Kolmogorov-Smirnov- statistic = D-    :    0.17
p-value of test                       :    0.51
 
Anderson-Darling statistic = A2       :    0.30
p-value of test                       :    0.94
 
Tests on the sum of all N observations
Standardized normal statistic         :   0.069
p-value of test                       :    0.47
 
Sample variance                       :    0.68
p-value of test                       :    0.73
 
-----------------------------------------------
CPU time used                    :  00:02:30.81
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_AutoCor test:
-----------------------------------------------
   N = 10,  n = 1000000030,  r = 27,   s = 3,   d = 1
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :   0.095
p-value of test                       :    0.78
 
Kolmogorov-Smirnov- statistic = D-    :    0.30
p-value of test                       :    0.14
 
Anderson-Darling statistic = A2       :    1.01
p-value of test                       :    0.35
 
Tests on the sum of all N observations
Standardized normal statistic         :    0.45
p-value of test                       :    0.33
 
Sample variance                       :    1.52
p-value of test                       :    0.13
 
-----------------------------------------------
CPU time used                    :  00:02:51.88
 
Generator state:
 
 
 
 
***********************************************************
HOST = Thijss-iMac.local, Darwin
 
sitmo
 
 
sstring_AutoCor test:
-----------------------------------------------
   N = 10,  n = 1000000029,  r = 27,   s = 3,   d = 3
 
 
-----------------------------------------------
 
Kolmogorov-Smirnov+ statistic = D+    :   0.079
p-value of test                       :    0.84
 
Kolmogorov-Smirnov- statistic = D-    :    0.18
p-value of test                       :    0.48
 
Anderson-Darling statistic = A2       :    0.59
p-value of test                       :    0.65
 
Tests on the sum of all N observations
Standardized normal statistic         :    0.78
p-value of test                       :    0.22
 
Sample variance                       :    1.85
p-value of test                       :    0.05
 
-----------------------------------------------
CPU time used                    :  00:02:32.94
 
Generator state:
 
 
 
 
 
========= Summary results of BigCrush =========
 
 Version:          TestU01 1.2.3
 Generator:        sitmo
 Number of statistics:  160
 Total CPU time:   03:44:06.82
 
 All tests were passed
sitmo/inst/doc/sitmo_internals.html0000644000176200001440000013771513413722032017242 0ustar liggesusers Deployment of sitmo within C++ Code

Deployment of sitmo within C++ Code

2019-01-04

Within this vignette, details on how to use sitmo’s header will be detailed. First, the background on sitmo will be provided. Secondly, function calls will be shown alongside of a description. Thirdly, examples will be provided of how one can use the sitmo header.

What is sitmo and can I eat it?

sitmo is the consultancy agency founded by Thijs van den Berg. They first released a Parallel Psuedo Random Number Generator (PPRNG) under the same name using work in Salmon, K., et al.’s “Parallel Random Numbers: As Easy as 1, 2, 3” in the conference proceedings of the 2011 International Conference for High Performance Computing, Networking, Storage and Analysis. Support for sitmo exists for both C++ standards: C++98 and C++11. Furthermore, there are many different PPRNGs that are available: trng, SPRNG, RngStreams, OMPRNG. However, none are as appealing in my eyes than sitmo, which provides a straight forward interface to generating psuedo-random numbers (RNG), the least restrictive license (MIT), and speed.

Over the span of the last few years, the sitmo agency has released two other engines of interest for C++11: threefry and vandercorput. The threefry engine is a rewritten PPRNG version of sitmo for C++11 whereas the vandercorput engine provides one dimensional low-discrepancy sequencing. The latter engines are also available under the MIT license.

Accessing and using engines in sitmo

The header files for sitmo, threefry, and vandercorput engines are contained within this package. To use one of these engine header files within your own package, you can link to the sitmo package within your description file. e.g.

LinkingTo: Rcpp, sitmo
Imports:
    Rcpp (>= 0.12.11)

To use C++11’s statistical distributions, you may want to add the following to your src/Makevars and src/Makevars.win file:

CXX_STD = CXX11

Within a C++ file in src/, then add:

You do not need to add each header file. Pick and choose the appropriate engine for your needs.

Or you can do a direct embed in your application. I would advise for the prior though and, hence, the reason for this package.

Below is a breakdown of functions that are available for the engines. Please note, that the engine predominantly highlight is the original: sitmo::prng.

Construct an engine

Expression Description
prng() Creates an engine with a default initial state.
prng(prng& x) Creates an engine with the same initial state as the engine x.
prng(uint32_t s) Creates an engine with initial state determined by s. Engines created with different initial states have the guarantee to generate independent non-overlapping random sequences of length \(2^128\).
prng(SeedSeq q) Creates an engine with an initial state that depends on a sequence produced by one call to q.generate.

Seed modifiers

To use the seed modifiers, one must first construct an engine using a method detailed in the previous table.

From there, the engine state can be modified using:

Expression Description
e.seed() Returns the random engine to the default state. The same prng().
e.seed(uint32_t s) Set the engine to a state determined by s. Same as prng(uint32_t s)
e.seed(SeedSeq q) Set the engine to a state that depends on a sequence produced by one call to q.generate. Same as prng(SeedSeq q)
e() Advances the internal state and returns a 32 bit random number.
e.discard(uint64_t n) Advances the internal state with n steps in constant time.

Misc Seed

Using the same engine created above, one can access additional state information using the following:

Expression Description
e1 == e2 Test for equivalence of two prng’s. Two engines are the same if they generate the exact same random sequence.
e1 != e2 Test for non-equivalence of two prng’s. Two engines are different if they generate different random sequences.
e.version() The current version of the engine, returns the value 2

Examples

The examples displayed in the vignette are taken directly from the project’s src directory that is found here https://github.com/coatless/sitmo. Additional commentary is added.

Uniform Random Number Generator

Under C++98, one does not have access to the C++11 implementation of the Uniform distribution. This is particularly problematic as a lot of the distribution RNG rely upon being able to sample from \(\left[0,1\right]\) ala the Probability Integral Transformation Theorem. Additional details are discussed in a separate vignette (“Making a Uniform PRNG with sitmo”).

OpenMP Example

One of the primary reasons why sitmo is desirable is because it can be used under parallelization via OpenMP and MPI. Below is an example where it is used in a parallel setting to generate numbers. Note, to ensure that code works cross-platform, please protect against OpenMP includes as the package will otherwise fail on OS X.

To protect against a lack of OpenMP headers use:

When writing sections of parallelized code, also protect that code using:

Furthermore, add the following to your Makevars and Makevars.win:

With this being said, let’s take a look at an example parallelization using sitmo:

#include <Rcpp.h>
#include <sitmo.h> // SITMO PPRNG

// [[Rcpp::depends(sitmo)]]

#ifdef _OPENMP
#include <omp.h>
#endif

// [[Rcpp::plugins(openmp)]]

//' Test Generation using sitmo and C++11
//' 
//' The function provides an implementation of creating realizations from the default engine.
//' 
//' @param n An \code{unsigned integer} denoting the number of realizations to generate.
//' @param seeds A \code{vec} containing a list of seeds. Each seed is run on its own core.
//' @return A \code{vec} containing the realizations.
//' @details
//' The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux).
//' However, it does provide a very good example as to how to make ones code applicable across multiple platforms.
//' 
//' With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied.
//' In the event that one is using OS X, only the first seed supplied is used. 
//' 
//' @export
//' @examples
//' a = sitmo_parallel(10, 5.0, c(1))
//' 
//' b = sitmo_parallel(10, 5.0, c(1))
//' 
//' c = sitmo_parallel(10, 5.0, c(2))
//' 
//' isTRUE(all.equal(a,b))
//' 
//' isTRUE(all.equal(a,c))
// [[Rcpp::export]]
Rcpp::NumericVector sitmo_parallel(unsigned int n, Rcpp::NumericVector& seeds){ 
  
  unsigned int ncores = seeds.size();

  Rcpp::NumericVector q(n);
  
  #ifdef _OPENMP
  #pragma omp parallel num_threads(ncores) if(ncores > 1)
  {
  #endif
  
    // Engine requires uint32_t inplace of unsigned int
    uint32_t active_seed;
      
    // Write the active seed per core or just write one of the seeds.
    #ifdef _OPENMP
      active_seed = static_cast<uint32_t>(seeds[omp_get_thread_num()]);
    #else
      active_seed = static_cast<uint32_t>(seeds[0]);
    #endif
    
    sitmo::prng eng( active_seed );
  
    // Parallelize the Loop
    #ifdef _OPENMP
    #pragma omp for schedule(static)
    #endif
    for (unsigned int i = 0; i < n; i++){
      q[i] = eng(). 
    }

  #ifdef _OPENMP
  }
  #endif
  
  return q;
}
sitmo/inst/doc/sitmo_internals.Rmd0000644000176200001440000004005613314572527017023 0ustar liggesusers--- title: "Deployment of `sitmo` within C++ Code" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Deployment of `sitmo` within C++ Code} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- Within this vignette, details on how to use [sitmo](https://github.com/stdfin/random/)'s header will be detailed. First, the background on `sitmo` will be provided. Secondly, function calls will be shown alongside of a description. Thirdly, examples will be provided of how one can use the `sitmo` header. # What is `sitmo` and can I eat it? `sitmo` is the consultancy agency founded by Thijs van den Berg. They first released a Parallel Psuedo Random Number Generator (PPRNG) under the same name using work in Salmon, K., et al.'s "Parallel Random Numbers: As Easy as 1, 2, 3" in the conference proceedings of the 2011 International Conference for High Performance Computing, Networking, Storage and Analysis. Support for `sitmo` exists for both C++ standards: C++98 and C++11. Furthermore, there are many different PPRNGs that are available: [trng](https://www.numbercrunch.de/trng/), [SPRNG](http://www.sprng.org/), [RngStreams](http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html), [OMPRNG](http://homepage.stat.uiowa.edu/~mbognar/omprng/). However, none are as appealing in my eyes than [sitmo](https://github.com/stdfin/random/), which provides a straight forward interface to generating psuedo-random numbers (RNG), the least restrictive license (MIT), and speed. Over the span of the last few years, the `sitmo` agency has released two other engines of interest for C++11: `threefry` and `vandercorput`. The `threefry` engine is a rewritten PPRNG version of `sitmo` for C++11 whereas the `vandercorput` engine provides one dimensional low-discrepancy sequencing. The latter engines are also available under the MIT license. # Accessing and using engines in `sitmo` The header files for `sitmo`, `threefry`, and `vandercorput` engines are contained within this package. To use one of these engine header files within your own package, you can link to the `sitmo` package within your description file. e.g. LinkingTo: Rcpp, sitmo Imports: Rcpp (>= 0.12.11) To use C++11's statistical distributions, you **may** want to add the following to your `src/Makevars` and `src/Makevars.win` file: CXX_STD = CXX11 Within a `C++` file in `src/`, then add: ```{Rcpp, eval = FALSE} #include #include // SITMO for C++98 & C++11 PPRNG #include // THREEFRY C++11-only PPRNG #include // VANDERCORPUT C++11-only Low-discrepancy sequence ``` You do _not_ need to add each header file. Pick and choose the appropriate engine for your needs. Or you can do a direct embed in your application. I would advise for the prior though and, hence, the reason for this package. Below is a breakdown of functions that are available for the engines. Please note, that the engine predominantly highlight is the original: `sitmo::prng`. ## Construct an engine | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | prng() | Creates an engine with a default initial state. | | prng(prng& x) | Creates an engine with the same initial state as the engine x. | | prng(uint32_t s) | Creates an engine with initial state determined by s. Engines created with different initial states have the guarantee to generate independent non-overlapping random sequences of length $2^128$. | | prng(SeedSeq q) | Creates an engine with an initial state that depends on a sequence produced by one call to q.generate. | ## Seed modifiers To use the seed modifiers, one must first construct an engine using a method detailed in the previous table. ```{Rcpp, eval = FALSE} // Generate engine called eng_org. sitmo::prng eng_org; // Generate engine called eng_org. sitmo::threefry eng_tf; // Generate engine called eng_vc. sitmo::vandercorput eng_vc; ``` From there, the engine state can be modified using: | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | e.seed() | Returns the random engine to the default state. The same prng(). | | e.seed(uint32_t s) | Set the engine to a state determined by s. Same as prng(uint32_t s) | | e.seed(SeedSeq q) | Set the engine to a state that depends on a sequence produced by one call to q.generate. Same as prng(SeedSeq q) | | e() | Advances the internal state and returns a 32 bit random number. | | e.discard(uint64_t n) | Advances the internal state with n steps in constant time. | ## Misc Seed Using the same engine created above, one can access additional state information using the following: | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | e1 == e2 | Test for equivalence of two prng’s. Two engines are the same if they generate the exact same random sequence. | | e1 != e2 | Test for non-equivalence of two prng’s. Two engines are different if they generate different random sequences. | | e.version() | The current version of the engine, returns the value 2 | ## Examples The examples displayed in the vignette are taken directly from the project's `src` directory that is found here [https://github.com/coatless/sitmo](https://github.com/coatless/sitmo). Additional commentary is added. ### Hello World Example Below is the most rudimentary example using `sitmo`. It describes the process of creating a `sitmo` engine and obtaining a draw. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example RNG Draws with sitmo //' //' Shows a basic setup and use case for sitmo. //' //' @param n A \code{unsigned int} is a . //' @return A \code{vec} with random sequences. //' @examples //' n = 10 //' sitmo_draws(n) // [[Rcpp::export]] Rcpp::NumericVector sitmo_draws(unsigned int n) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng; // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i) = eng(); } return o; } ``` ### Setting a Seed Here the ability for a seed to be set is used. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{vector} with random sequences. //' @examples //' n = 10 //' a = sitmo_engine_seed(n, 1337) //' b = sitmo_engine_seed(n, 1337) //' c = sitmo_engine_seed(n, 1338) //' //' isTRUE(all.equal(a,b)) //' isTRUE(all.equal(a,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_engine_seed(unsigned int n, unsigned int seed) { // Create Rcpp Matrix Rcpp::NumericVector o(n); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n; ++i){ o(i) = eng(); } return o; } ``` ### Reset RNG engine The code used here can be found to work when the initial state of the engine needs to be reverted. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{matrix} with random sequences. //' @examples //' n = 10 //' a = sitmo_engine_seed(n, 1337) //' //' isTRUE(all.equal(a[,1],a[,2])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_engine_reset(unsigned int n, unsigned int seed) { // Create Rcpp Vector Rcpp::NumericMatrix o(n,2); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n ; ++i){ o(i,0) = eng(); } // Reset seed eng.seed(); // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i,1) = eng(); } return o; } ``` ### Two RNG Streams This example displays the ability of `sitmo` to handle parallel streams of rng when a predefined number of streams is known. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Two RNG engines running side-by-side //' //' Shows how to create two separate RNGs and increase them together. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seeds A \code{vec} containing two integers greater than 0. //' @return A \code{matrix} with random sequences. //' @examples //' n = 10 //' a = sitmo_two_seeds(n, c(1337,1338)) //' //' b = sitmo_two_seeds(n, c(1337,1337)) //' //' isTRUE(all.equal(a[,1],a[,2])) //' //' isTRUE(all.equal(b[,1],b[,2])) //' //' isTRUE(all.equal(a[,1],b[,1])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_two_seeds(unsigned int n, Rcpp::NumericVector seeds) { if(seeds.size() != 2) Rcpp::stop("Need exactly two seeds for this example."); // Create Rcpp Matrix Rcpp::NumericMatrix o(n,2); // Create a prng engine with a specific seed sitmo::prng eng1; eng1.seed(seeds(0)); sitmo::prng eng2; eng2.seed(seeds(1)); // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i,0) = eng1(); o(i,1) = eng2(); } return o; } ``` ### Uniform Random Number Generator Under C++98, one does not have access to the C++11 implementation of the Uniform distribution. This is particularly problematic as a lot of the distribution RNG rely upon being able to sample from $\left[0,1\right]$ ala the Probability Integral Transformation Theorem. Additional details are discussed in a separate vignette ("Making a Uniform PRNG with sitmo"). ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Random Uniform Number Generator with sitmo //' //' The function provides an implementation of sampling from a random uniform distribution //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param seed A special \code{unsigned integer} containing a single seed. //' @return A \code{vec} containing the realizations. //' @export //' @examples //' a = runif_sitmo(10) // [[Rcpp::export]] Rcpp::NumericVector runif_sitmo(unsigned int n, double min = 0.0, double max = 1.0, uint32_t seed = 1) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng(seed); // Obtain the range between max and min double dis = max - min; for(int i = 0; i < n; ++i) { // Sample from the RNG and divide it by the maximum value possible (can also use SITMO_RAND_MAX, which is 4294967295) // Apply appropriate scale (MAX-MIN) o[i] = min + ((double) eng() / (sitmo::prng::max())) * (dis); } return o; } ``` ### OpenMP Example One of the primary reasons why `sitmo` is desirable is because it can be used under parallelization via OpenMP and MPI. Below is an example where it is used in a parallel setting to generate numbers. Note, to ensure that code works cross-platform, please protect against OpenMP includes as the package will otherwise fail on OS X. To protect against a lack of OpenMP headers use: ```{Rcpp, eval = FALSE} #ifdef _OPENMP #include #endif ``` When writing sections of parallelized code, also protect that code using: ```{Rcpp, eval = FALSE} #ifdef _OPENMP // multithreaded OpenMP version of code #else // single-threaded version of code #endif ``` Furthermore, add the following to your `Makevars` and `Makevars.win`: ```{r engine='asis', eval = F} PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS) PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS) ``` With this being said, let's take a look at an example parallelization using `sitmo`: ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] #ifdef _OPENMP #include #endif // [[Rcpp::plugins(openmp)]] //' Test Generation using sitmo and C++11 //' //' The function provides an implementation of creating realizations from the default engine. //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param seeds A \code{vec} containing a list of seeds. Each seed is run on its own core. //' @return A \code{vec} containing the realizations. //' @details //' The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux). //' However, it does provide a very good example as to how to make ones code applicable across multiple platforms. //' //' With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied. //' In the event that one is using OS X, only the first seed supplied is used. //' //' @export //' @examples //' a = sitmo_parallel(10, 5.0, c(1)) //' //' b = sitmo_parallel(10, 5.0, c(1)) //' //' c = sitmo_parallel(10, 5.0, c(2)) //' //' isTRUE(all.equal(a,b)) //' //' isTRUE(all.equal(a,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_parallel(unsigned int n, Rcpp::NumericVector& seeds){ unsigned int ncores = seeds.size(); Rcpp::NumericVector q(n); #ifdef _OPENMP #pragma omp parallel num_threads(ncores) if(ncores > 1) { #endif // Engine requires uint32_t inplace of unsigned int uint32_t active_seed; // Write the active seed per core or just write one of the seeds. #ifdef _OPENMP active_seed = static_cast(seeds[omp_get_thread_num()]); #else active_seed = static_cast(seeds[0]); #endif sitmo::prng eng( active_seed ); // Parallelize the Loop #ifdef _OPENMP #pragma omp for schedule(static) #endif for (unsigned int i = 0; i < n; i++){ q[i] = eng(). } #ifdef _OPENMP } #endif return q; } ``` sitmo/inst/include/0000755000176200001440000000000013314703522014005 5ustar liggesuserssitmo/inst/include/vandercorput.h0000644000176200001440000001676013413716655016717 0ustar liggesusers// Copyright (c) 2014 M.A. (Thijs) van den Berg, http://sitmo.com/ // // Use, modification and distribution are subject to the MIT Software License. // (See accompanying file LICENSE.txt) #ifndef SITMO_RANDOM_VANDERCORPUT_HHP #define SITMO_RANDOM_VANDERCORPUT_HHP 1 #include namespace sitmo { namespace detail { template constexpr std::size_t max_base_digits_imp(UIntType base, UIntType maxval) { return (maxval >= base - 1) ? 1 + max_base_digits_imp(base, (maxval - base + 1)/base) : 0; }; /** * @brief computed the largest n such that base^n - 1 fits in a UIntType */ template constexpr std::size_t max_base_digits(std::size_t base) { return max_base_digits_imp(base, std::numeric_limits::max()); }; template constexpr UIntType max_base_value_imp(UIntType B, UIntType U) { return (U==0) ? 0 : B - 1 + B * max_base_value_imp(B, (U-1)/B ); }; /** * @brief computed the largest value of the form base^n - 1 that fits in a UIntType */ template constexpr UIntType max_base_value(UIntType B) { return max_base_value_imp(B, std::numeric_limits::max() / (B-1) ); }; } // namespace detail /** * @brief The van der Corput low discrepancy random number generator. * * A random number generator that produces pseudorandom numbers using * van der Corput sequences. It is constructed by reversing the base n * representation of the sequence of natural numbers 1,2,3,.. * * The template parameter @p UIntType must be an unsigned integral type. * The template parameter @p base must be an integral number of at last 2 * and at most std::numeric_limits::max(). * * The size of the state is UIntType. */ template class vandercorput_engine { static_assert(std::is_unsigned::value || std::is_integral::value, "template argument UIntType not an unsigned integral type"); static_assert(base_ >= 2u || (base_ <= std::numeric_limits::max() ), "template argument base out of bounds"); public: /** The type of the generated random value. */ typedef UIntType result_type; /** The default seed. */ static constexpr result_type default_seed = 1; /** The base used for the sequence.. */ static constexpr size_t base = base_; /** * @brief Gets the smallest possible value in the output range. */ static constexpr result_type (min)() { return 0; } /** * @brief Gets the largest possible value in the output range. */ static constexpr result_type (max)() { return detail::max_base_value(base); } /** * @brief Constructs a %vandercorput_engine random number * generator engine with seed @p __s. The default seed value * is 1. * * @param __s The initial seed value. */ explicit vandercorput_engine(result_type __s = default_seed) { seed(__s); } /** * @brief Constructs a %vandercorput_engine random number * generator engine seeded from the seed sequence @p __q. * * @param __q the seed sequence. */ template::value >::type> vandercorput_engine(_Sseq& __q) { seed(__q); } /** * @brief Reseeds the %vandercorput_engine random number * generator engine with the seed @p __s. * The default seed value is 1. * * @param __s the new seed. */ void seed(result_type __s = default_seed) { _M_counter = __s;} /** * @brief Seeds the %vandercorput_engine random number * generator engine with the seed sequence @p __q. * * @param __p the seed sequence. */ template typename std::enable_if< std::is_class< _Sseq >::value >::type seed(_Sseq& __q) { const size_t samples = 1 + ( (sizeof(UIntType) - 1) / sizeof(typename _Sseq::result_type) ); typename _Sseq::result_type w[samples]; __q.generate(&w[samples], &w[samples]); _M_counter = static_cast(w[0]); } /** * @brief Generate a random sample. */ result_type operator()() { result_type vdc = 0; result_type n = _M_counter; for (unsigned int i=0; i(base); ++i) { vdc *= base; vdc += n % base; n /= base; } ++_M_counter; return vdc; } /** * @brief Discard a number of elements from the random numbers sequence. * * @param __z the number of elements to discard. */ void discard(result_type __z) { _M_counter += __z; } /** * @brief Writes the textual representation of the state x(i) of x to * @p __os. * * @param __os The output stream. * @param __eng A % vandercorput_engine random number generator. * @returns __os. */ template friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const vandercorput_engine& __eng) { __os << __eng._M_counter; return __os; } /** * @brief reads the textual representation of the state x(i) of x from * @p __is. * * @param __is The input stream. * @param __eng A % vandercorput_engine random number generator. * @returns __is. */ template friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, vandercorput_engine& __eng) { __is >> __eng._M_counter; return __is; } /** * @brief Compares two van der Corput random number generator * objects of the same type for equality. * * * @param __lhs A van der Corput random number generator object. * @param __rhs Another van der Corput random number generator * object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const vandercorput_engine& __lhs, const vandercorput_engine& __rhs) { return (__lhs._M_counter == __rhs._M_counter); } /** * @brief Compares two van der Corput random number generator * objects of the same type for inequality. * * * @param __lhs A van der Corput random number generator object. * @param __rhs Another van der Corput random number generator * object. * * @returns true if the infinite sequences of generated values * would not be equal, false otherwise. */ friend bool operator!=(const vandercorput_engine& __lhs, const vandercorput_engine& __rhs) { return (__lhs._M_counter != __rhs._M_counter); } private: UIntType _M_counter; }; /** * The base 2, 32 bit van der Corput engine. */ typedef vandercorput_engine vandercorput; /** * The base 2, 64 bit van der Corput engine. */ typedef vandercorput_engine vandercorput_64; } // namespace sitmo #endif sitmo/inst/include/threefry.h0000644000176200001440000004445013314572527016026 0ustar liggesusers/* stdfin random/threefry.hpp header file * * Copyright Thijs van den Berg 2014-2015 * * Distributed under the MIT Software License. * See the accompanying file LICENSE or copy at http://opensource.org/licenses/MIT * */ #ifndef SITMO_RANDOM_THREEFRY_HPP #define SITMO_RANDOM_THREEFRY_HPP #include #include #include #include //debug #include #include namespace sitmo { /** * @brief The threefry random engine is a counter based random engine that uses a * stripped-down Threefish cryptographic function that is optimised for speed. * * The template parameter @p UIntType the return type of the random engine, must be an * unsigned integral type, e.g. uint64_t. * The template parameter @p w is the width of the return type, the number of bits. * Valid values are 8,16,32,64. * The template parameter @p r the number of mix-rounds. 13 round or higher give very good * quality random numbers. * * @blockquote * title: Parallel random numbers: as easy as 1, 2, 3 * authors: Salmon, John K. and Moraes, Mark A. and Dror, Ron O. and Shaw, David E. * booktitle: Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis * publicher: ACM * year: 2011 * isbn: 978-1-4503-0771-0 * @endblockquote * * @xmlnote * The stdfin variant has been implemented from scratch and does not * derive from or use the Random123 library provided at http://www.thesalmons.org/john/random123/ * However, it was verified that both produce identical output. * Output was verified against the threefry4x64 unit test cases from https://github.com/girving/random123/blob/master/examples/kat_vectors * @endxmlnote */ namespace detail { static const uint_least64_t threefry4x64_tweak = 0x1BD11BDAA9FC1A22; // primary template template< typename UIntType, std::size_t w> struct extract4x64_impl { inline static UIntType zth(const uint_least64_t (&_output)[4]); inline static UIntType nth(const uint_least64_t (&_output)[4], std::size_t n); inline static constexpr UIntType w_max(); }; // specialisation template< typename UIntType> struct extract4x64_impl { inline static UIntType zth(const uint_least64_t (&_output)[4]) { return _output[0]; } inline static UIntType nth(const uint_least64_t (&_output)[4], std::size_t n) { return _output[n]; } inline static constexpr UIntType w_max() { return 0xFFFFFFFFFFFFFFFF; } }; template< typename UIntType> struct extract4x64_impl { inline static UIntType zth(const uint_least64_t (&_output)[4]) { return _output[0] & 0xFFFFFFFF; } inline static UIntType nth(const uint_least64_t (&_output)[4], std::size_t n) { return (_output[n>>1] >> ((n&1)<<5)) & 0xFFFFFFFF; } inline static constexpr UIntType w_max() { return 0xFFFFFFFF; } }; template< typename UIntType> struct extract4x64_impl { inline static UIntType zth(const uint_least64_t (&_output)[4]) { return _output[0] & 0xFFFF; } inline static UIntType nth(const uint_least64_t (&_output)[4], std::size_t n) { return (_output[n>>2] >> ((n&3)<<4)) & 0xFFFF; } inline static constexpr UIntType w_max() { return 0xFFFF; } }; template< typename UIntType> struct extract4x64_impl { inline static UIntType zth(const uint_least64_t (&_output)[4]) { return _output[0] & 0xFF; } inline static UIntType nth(const uint_least64_t (&_output)[4], std::size_t n) { return (_output[n>>3] >> ((n&7)<<3)) & 0xFF; } inline static constexpr UIntType w_max() { return 0xFF; } }; template struct is_seed_sequence { static constexpr bool value = !std::is_convertible::value && !std::is_same::type, Eng>::value; }; } template < typename UIntType=uint32_t, // the return type std::size_t w=32, // number of bits in the return type std::size_t r=13 // number of rounds > class threefry_engine { public: // check for supported nr of bits in return type static_assert( w==8 || w==16 || w==32 || w==64, "threefry_engine: invalid template argument. Number of bits must be 8,16,32, or 64"); // types typedef UIntType result_type; // engine characteristics static constexpr std::size_t word_size = w; static constexpr std::size_t rounds = r; static constexpr std::size_t samples_per_block = 256/w; /** * @brief Constructs the defafult %threefry_engine. */ threefry_engine() { seed(0); } /** * @brief Constructs a %threefry_engine random number * generator engine with seed @p value. The default seed value * is 0. * * @param value The initial seed value. */ explicit threefry_engine(UIntType value) { seed(value); } /** * @brief Constructs a %threefry_engine random number * generator engine seeded from the seed sequence @p seq. * * @param seq the seed sequence. */ template explicit threefry_engine(SeedSeq& seq, typename std::enable_if::value>::type* = 0) { seed(seq); } /** * @brief Re-seed the %threefry_engine to it's default seed. */ void seed() { seed(0); } /** * @brief Re-seed the %threefry_engine random number * generator engine with the seed @p value. * The default seed value is 0. * * @param value the new seed. */ void seed(result_type value) { _key[0] = value; _key[1] = 0; _key[2] = 0; _key[3] = 0; reset_after_key_change(); } /** * @brief Seeds the %threefry_engine random number * generator engine with the seed sequence @p seq. * * @param seq the seed sequence. */ template void seed(SeedSeq& seq) { seed(seq, typename std::is_fundamental::type()); reset_after_key_change(); } /** * @brief Gets the smallest possible value in the output range. */ static constexpr result_type (min)() { return 0; } /** * @brief Gets the largest possible value in the output range. */ static constexpr result_type (max)() { return detail::extract4x64_impl::w_max(); } /** * @brief Generate a random sample. */ result_type operator()() { // can we return a value from the current block? if (_o_counter < samples_per_block) return detail::extract4x64_impl::nth(_output, _o_counter++); // generate a new block and return the first result_type inc_counter(); encrypt_counter(); _o_counter = 1; // the next call return detail::extract4x64_impl::zth(_output); } /** * @brief Discard a number of elements from the random numbers sequence. * * @param z the number of elements to discard. */ void discard(unsigned long long z) { // check if we stay in the current block if (z < samples_per_block - _o_counter) { _o_counter += static_cast(z); return; } // we will have to generate a new block... z -= (samples_per_block - _o_counter); // discard the remainder of the current blok _o_counter = z % samples_per_block; // set the pointer in the correct element in the new block z -= _o_counter; // update z z /= samples_per_block; // the number of 256 bit bocks to skip is z/samples_per_block ++z; // and one more because we crossed the buffer line inc_counter(z); encrypt_counter(); } /** * @brief Writes the textual representation of the state x(i) of x to * @p _os. * * @param os The output stream. * @param eng A %threefry_engine random number generator. * @returns os. */ template friend std::basic_ostream& operator<<(std::basic_ostream& os, const threefry_engine& eng) { for (unsigned short i=0; i<4; ++i) os << eng._key[i] << ' '; for (unsigned short i=0; i<4; ++i) os << eng._counter[i] << ' '; os << eng._o_counter; return os; } /** * @brief reads the textual representation of the state x(i) from * @p is. * * @param is The input stream. * @param eng A %threefry_engine random number generator. * @returns is. */ template friend std::basic_istream& operator >> (std::basic_istream& is, threefry_engine& eng) { for (unsigned short i=0; i<4; ++i) is >> eng._key[i] >> std::ws; for (unsigned short i=0; i<4; ++i) is >> eng._counter[i] >> std::ws; is >> eng._o_counter; eng._key[4] = detail::threefry4x64_tweak ^ eng._key[0] ^ eng._key[1] ^ eng._key[2] ^ eng._key[3]; eng.encrypt_counter(); return is; } /** * @brief Compares two %threefry_engine * objects of the same type for equality. * * * @param _lhs A threefry engine. * @param _rhs Another threefry engine. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const threefry_engine& _lhs, const threefry_engine& _rhs) { if (_lhs._o_counter != _rhs._o_counter) return false; for (unsigned short i=0; i<4; ++i) { if (_lhs._counter[i] != _rhs._counter[i]) return false; if (_lhs._key[i] != _rhs._key[i]) return false; if (_lhs._output[i] != _rhs._output[i]) return false; } return true; } /** * @brief Compares two threefry engines for inequality. * * * @param _lhs A threefry engine. * @param _rhs Another threefry engine. * * @returns true if the infinite sequences of generated values * would not be equal, false otherwise. */ friend bool operator!=(const threefry_engine& _lhs, const threefry_engine& _rhs) { return !(_lhs == _rhs); } // Extra function to set the key void set_key(uint64_t k0=0, uint64_t k1=0, uint64_t k2=0, uint64_t k3=0) { _key[0] = k0; _key[1] = k1; _key[2] = k2; _key[3] = k3; encrypt_counter(); } // set the counter void set_counter(uint64_t s0=0, uint64_t s1=0, uint64_t s2=0, uint64_t s3=0, unsigned short o_counter=0) { _counter[0] = s0; _counter[1] = s1; _counter[2] = s2; _counter[3] = s3; _o_counter = o_counter % 8; encrypt_counter(); } private: template void seed(Gen& gen, std::true_type) { return seed(static_cast(gen)); } template void seed(Gen& gen, std::false_type) { typename Gen::result_type data[8]; gen.generate(&data[0], &data[8]); for (unsigned short i=0; i<4; ++i) { _key[i] = ( static_cast(data[2*i]) << 32) | data[2*i+1]; _counter[i] = 0; } _o_counter = 0; } inline void rotl64(uint_least64_t& v, const uint8_t bits) const { v = (v << bits) | (v >> (sizeof(uint_least64_t) * 8 - bits)); } inline void mix64(uint_least64_t& x0, uint64_t& x1, const uint8_t bits) const { x0 += x1; rotl64(x1, bits); x1 ^= x0; } inline void double_mix64( uint_least64_t& x0, uint_least64_t& x1, const uint8_t rx, uint_least64_t& z0, uint_least64_t& z1, const uint8_t rz) const { mix64(x0,x1,rx); mix64(z0,z1,rz); } template inline void add_key64_t( uint_least64_t (&output)[4], uint_least64_t (&key)[5], const std::size_t c) const { output[0] += key[ offset %5]; output[1] += key[(offset+1)%5]; output[2] += key[(offset+2)%5]; output[3] += key[(offset+3)%5]; output[3] += c; } template inline void encrypt_counter_t(std::size_t& four_cycles) { if (Rounds>=1) double_mix64( _output[0], _output[1], 14, _output[2], _output[3], 16); if (Rounds>=2) double_mix64( _output[0], _output[3], 52, _output[2], _output[1], 57); if (Rounds>=3) double_mix64( _output[0], _output[1], 23, _output[2], _output[3], 40); if (Rounds>=4) { double_mix64( _output[0], _output[3], 5, _output[2], _output[1], 37); add_key64_t<1>(_output, _key, ++four_cycles); } if (Rounds>=5) double_mix64( _output[0], _output[1], 25, _output[2], _output[3], 33); if (Rounds>=6) double_mix64( _output[0], _output[3], 46, _output[2], _output[1], 12); if (Rounds>=7) double_mix64( _output[0], _output[1], 58, _output[2], _output[3], 22); if (Rounds>=8) { double_mix64( _output[0], _output[3], 32, _output[2], _output[1], 32); add_key64_t<2>(_output, _key, ++four_cycles); } if (Rounds>=9) double_mix64( _output[0], _output[1], 14, _output[2], _output[3], 16); if (Rounds>=10) double_mix64( _output[0], _output[3], 52, _output[2], _output[1], 57); if (Rounds>=11) double_mix64( _output[0], _output[1], 23, _output[2], _output[3], 40); if (Rounds>=12) { double_mix64( _output[0], _output[3], 5, _output[2], _output[1], 37); add_key64_t<3>(_output, _key, ++four_cycles); } if (Rounds>=13) double_mix64( _output[0], _output[1], 25, _output[2], _output[3], 33); if (Rounds>=14) double_mix64( _output[0], _output[3], 46, _output[2], _output[1], 12); if (Rounds>=15) double_mix64( _output[0], _output[1], 58, _output[2], _output[3], 22); if (Rounds>=16) { double_mix64( _output[0], _output[3], 32, _output[2], _output[1], 32); add_key64_t<4>(_output, _key, ++four_cycles); } if (Rounds>=17) double_mix64( _output[0], _output[1], 14, _output[2], _output[3], 16); if (Rounds>=18) double_mix64( _output[0], _output[3], 52, _output[2], _output[1], 57); if (Rounds>=19) double_mix64( _output[0], _output[1], 23, _output[2], _output[3], 40); if (Rounds>=20) { double_mix64( _output[0], _output[3], 5, _output[2], _output[1], 37); add_key64_t<0>(_output, _key, ++four_cycles); } if (Rounds>=21) double_mix64( _output[0], _output[1], 25, _output[2], _output[3], 33); if (Rounds>=22) double_mix64( _output[0], _output[3], 46, _output[2], _output[1], 12); if (Rounds>=23) double_mix64( _output[0], _output[1], 58, _output[2], _output[3], 22); if (Rounds>=24) { double_mix64( _output[0], _output[3], 32, _output[2], _output[1], 32); add_key64_t<1>(_output, _key, ++four_cycles); } if (Rounds>=25) double_mix64( _output[0], _output[1], 14, _output[2], _output[3], 16); if (Rounds>=26) double_mix64( _output[0], _output[3], 52, _output[2], _output[1], 57); if (Rounds>=27) double_mix64( _output[0], _output[1], 23, _output[2], _output[3], 40); if (Rounds>=28) { double_mix64( _output[0], _output[3], 5, _output[2], _output[1], 37); add_key64_t<2>(_output, _key, ++four_cycles); } if (Rounds>=29) double_mix64( _output[0], _output[1], 25, _output[2], _output[3], 33); if (Rounds>=30) double_mix64( _output[0], _output[3], 46, _output[2], _output[1], 12); if (Rounds>=31) double_mix64( _output[0], _output[1], 58, _output[2], _output[3], 22); if (Rounds>=32) { double_mix64( _output[0], _output[3], 32, _output[2], _output[1], 32); add_key64_t<3>(_output, _key, ++four_cycles); } if (Rounds>=33) double_mix64( _output[0], _output[1], 14, _output[2], _output[3], 16); if (Rounds>=34) double_mix64( _output[0], _output[3], 52, _output[2], _output[1], 57); if (Rounds>=35) double_mix64( _output[0], _output[1], 23, _output[2], _output[3], 40); if (Rounds>=36) { double_mix64( _output[0], _output[3], 5, _output[2], _output[1], 37); add_key64_t<4>(_output, _key, ++four_cycles); } if (Rounds>=37) double_mix64( _output[0], _output[1], 25, _output[2], _output[3], 33); if (Rounds>=38) double_mix64( _output[0], _output[3], 46, _output[2], _output[1], 12); if (Rounds>=39) double_mix64( _output[0], _output[1], 58, _output[2], _output[3], 22); if (Rounds>=40) { double_mix64( _output[0], _output[3], 32, _output[2], _output[1], 32); add_key64_t<0>(_output, _key, ++four_cycles); } } void encrypt_counter() { for (std::size_t i=0; i<4; ++i) _output[i] = _counter[i]; for (std::size_t i=0; i<4; ++i) _output[i] += _key[i]; std::size_t four_cycles = 0; // do chunks of 40 rounds for (std::size_t big_rounds=0; big_rounds < r/40; ++big_rounds) encrypt_counter_t<40>(four_cycles); // the remaining rounds encrypt_counter_t(four_cycles); } // increment the counter with 1 void inc_counter() { ++_counter[0]; if (_counter[0] != 0) return; ++_counter[1]; if (_counter[1] != 0) return; ++_counter[2]; if (_counter[2] != 0) return; ++_counter[3]; } // increment the counter with z void inc_counter(uint_least64_t z) { if (z > 0xFFFFFFFFFFFFFFFF - _counter[0]) { // check if we will overflow the first 64 bit of the counter ++_counter[1]; if (_counter[1] == 0) { ++_counter[2]; if (_counter[2] == 0) { ++_counter[3]; } } } _counter[0] += z; } void reset_counter() { _counter[0] = 0; _counter[1] = 0; _counter[2] = 0; _counter[3] = 0; _o_counter = 0; } // reset the counter to zero, and reset the keyx void reset_after_key_change() { _key[4] = detail::threefry4x64_tweak ^ _key[0] ^ _key[1] ^ _key[2] ^ _key[3]; reset_counter(); encrypt_counter(); } private: uint_least64_t _counter[4]; // the 256 bit counter (message) that gets encrypted uint_least64_t _output[4]; // the 256 bit cipher output 4 * 64 bit = 256 bit output uint_least64_t _key[5]; // the 256 bit encryption key uint_least16_t _o_counter; // output chunk counter, e.g. for a 64 bit random engine // the 256 bit output buffer gets split in 4x64bit chunks or 8x32bit chunks chunks. /// \endcond }; /** * 32 bit version of the 13 rounds threefry engine */ typedef threefry_engine threefry_13_32; /** * 64 bit version of the 13 rounds threefry engine */ typedef threefry_engine threefry_13_64; /** * 32 bit version of the 20 rounds threefry engine */ typedef threefry_engine threefry_20_32; /** * 64 bit version of the 20 rounds threefry engine */ typedef threefry_engine threefry_20_64; typedef threefry_engine threefry; // default } // namespace sitmo #endif // STDFIN_RANDOM_THREEFRY_HPP sitmo/inst/include/sitmo.h0000644000176200001440000002760613314572527015335 0ustar liggesusers// Copyright (c) 2012-2016 M.A. (Thijs) van den Berg, http://sitmo.com/ // // Use, modification and distribution are subject to the MIT Software License. // // The MIT License (MIT) // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // version history: // version 1, 6 Sep 2012 // version 2, 10 Dec 2013 // bug fix in the discard() routine, it was discarding to many elements // added the version() method // version 3...5, 13 Dec 2013 // fixed type-conversion earning // fixed potential issues with constructor template matching #ifndef SITMO_PRNG_ENGINE_HPP #define SITMO_PRNG_ENGINE_HPP #include #ifdef __GNUC__ #include // respecting the C99 standard. #endif #ifdef _MSC_VER typedef unsigned __int64 uint64_t; // Visual Studio 6.0(VC6) and newer.. typedef unsigned __int32 uint32_t; #endif #define SITMO_RAND_MAX sitmo::prng_engine::max() // Double mixing function #define MIX2(x0,x1,rx,z0,z1,rz) \ x0 += x1; \ z0 += z1; \ x1 = (x1 << rx) | (x1 >> (64-rx)); \ z1 = (z1 << rz) | (z1 >> (64-rz)); \ x1 ^= x0; \ z1 ^= z0; // Double mixing function with key adition #define MIXK(x0,x1,rx,z0,z1,rz,k0,k1,l0,l1) \ x1 += k1; \ z1 += l1; \ x0 += x1+k0; \ z0 += z1+l0; \ x1 = (x1 << rx) | (x1 >> (64-rx)); \ z1 = (z1 << rz) | (z1 >> (64-rz)); \ x1 ^= x0; \ z1 ^= z0; \ namespace sitmo { // enable_if for C__98 compilers template struct sitmo_enable_if { typedef T type; }; template struct sitmo_enable_if { }; // SFINAE check for the existence of a "void generate(int*,int*)"member function template struct has_generate_template { typedef char (&Two)[2]; template struct helper {}; template static char test(helper >*); template static Two test(...); static bool const value = sizeof(test(0)) == sizeof(char); }; class prng_engine { public: // "req" are requirements as stated in the C++ 11 draft n3242=11-0012 // // req: 26.5.1.3 Uniform random number generator requirements, p.906, table 116, row 1 typedef uint32_t result_type; // req: 26.5.1.3 Uniform random number generator requirements, p.906, table 116, row 3 & 4 #if __cplusplus <= 199711L static result_type (min)() { return 0; } static result_type (max)() { return 0xFFFFFFFF; } #else static constexpr result_type (min)() { return 0; } static constexpr result_type (max)() { return 0xFFFFFFFF; } #endif // ------------------------------------------------- // Constructors // ------------------------------------------------- // req: 26.5.1.4 Random number engine requirements, p.907 table 117, row 1 // Creates an engine with the same initial state as all other // default-constructed engines of type E. prng_engine() { seed(); } // req: 26.5.1.4 Random number engine requirements, p.907 table 117, row 2 // Creates an engine that compares equal to x. prng_engine(const prng_engine& x) { for (unsigned short i=0; i<4; ++i) { _s[i] = x._s[i]; _k[i] = x._k[i]; _o[i] = x._o[i]; } _o_counter = x._o_counter; } // req: 26.5.1.4 Random number engine requirements, p.907 table 117, row 3 // Creates an engine with initial O(size of state) state determined by s. prng_engine(uint32_t s) { seed(s); } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 4 // Creates an engine with an initial state that depends on a sequence // produced by one call to q.generate. template prng_engine(Seq& q, typename sitmo_enable_if< has_generate_template::value >::type* = 0 ) { seed(q); } // ------------------------------------------------- // Seeding // ------------------------------------------------- // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 5 void seed() { for (unsigned short i=0; i<4; ++i) { _k[i] = 0; _s[i] = 0; } _o_counter = 0; _o[0] = 0x09218ebde6c85537; _o[1] = 0x55941f5266d86105; _o[2] = 0x4bd25e16282434dc; _o[3] = 0xee29ec846bd2e40b; } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 6 // s needs to be of return_type, which is uint32_t void seed(uint32_t s) { for (unsigned short i=0; i<4; ++i) { _k[i] = 0; _s[i] = 0; } _k[0] = s; _o_counter = 0; encrypt_counter(); } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 7 template void seed(Seq& q, typename sitmo_enable_if< has_generate_template::value >::type* = 0 ) { typename Seq::result_type w[8]; q.generate(&w[0], &w[8]); for (unsigned short i=0; i<4; ++i) { _k[i] = ( static_cast(w[2*i]) << 32) | w[2*i+1]; _s[i] = 0; } _o_counter = 0; encrypt_counter(); } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 8 // Advances e’s state ei to ei+1 = TA(ei) and returns GA(ei). uint32_t operator()() { // can we return a value from the current block? if (_o_counter < 8) { unsigned short _o_index = _o_counter >> 1; _o_counter++; if (_o_counter&1) return _o[_o_index] & 0xFFFFFFFF; else return _o[_o_index] >> 32; } // generate a new block and return the first 32 bits inc_counter(); encrypt_counter(); _o_counter = 1; // the next call return _o[0] & 0xFFFFFFFF; // this call } // ------------------------------------------------- // misc // ------------------------------------------------- // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 9 // Advances e’s state ei to ei+z by any means equivalent to z // consecutive calls e(). void discard(uint64_t z) { // check if we stay in the current block // cast to unsigned int to prevent comparison warning if (z < (uint64_t)(8 - _o_counter)) { _o_counter += static_cast(z); return; } // we will have to generate a new block... z -= (8 - _o_counter); // discard the remainder of the current blok _o_counter = z % 8; // set the pointer in the correct element in the new block z -= _o_counter; // update z z >>= 3; // the number of buffers is elements/8 ++z; // and one more because we crossed the buffer line inc_counter(z); encrypt_counter(); } // ------------------------------------------------- // IO // ------------------------------------------------- template friend std::basic_ostream& operator<<(std::basic_ostream& os, const prng_engine& s) { for (unsigned short i=0; i<4; ++i) os << s._k[i] << ' ' << s._s[i] << ' ' << s._o[i] << ' '; os << s._o_counter; return os; } template friend std::basic_istream& operator>>(std::basic_istream& is, prng_engine& s) { for (unsigned short i=0; i<4; ++i) is >> s._k[i] >> s._s[i] >> s._o[i]; is >> s._o_counter; return is; } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 10 // This operator is an equivalence relation. With Sx and Sy as the infinite // sequences of values that would be generated by repeated future calls to // x() and y(), respectively, returns true if Sx = Sy; else returns false. bool operator==(const prng_engine& y) { if (_o_counter != y._o_counter) return false; for (unsigned short i=0; i<4; ++i) { if (_s[i] != y._s[i]) return false; if (_k[i] != y._k[i]) return false; if (_o[i] != y._o[i]) return false; } return true; } // req: 26.5.1.4 Random number engine requirements, p.908 table 117, row 11 bool operator!=(const prng_engine& y) { return !(*this == y); } // Extra function to set the key void set_key(uint64_t k0=0, uint64_t k1=0, uint64_t k2=0, uint64_t k3=0) { _k[0] = k0; _k[1] = k1; _k[2] = k2; _k[3] = k3; encrypt_counter(); } // set the counter void set_counter(uint64_t s0=0, uint64_t s1=0, uint64_t s2=0, uint64_t s3=0, unsigned short o_counter=0) { _s[0] = s0; _s[1] = s1; _s[2] = s2; _s[3] = s3; _o_counter = o_counter % 8; encrypt_counter(); } // versioning uint32_t version() { return 5; } private: void encrypt_counter() { uint64_t b[4]; uint64_t k[5]; for (unsigned short i=0; i<4; ++i) b[i] = _s[i]; for (unsigned short i=0; i<4; ++i) k[i] = _k[i]; k[4] = 0x1BD11BDAA9FC1A22 ^ k[0] ^ k[1] ^ k[2] ^ k[3]; MIXK(b[0], b[1], 14, b[2], b[3], 16, k[0], k[1], k[2], k[3]); MIX2(b[0], b[3], 52, b[2], b[1], 57); MIX2(b[0], b[1], 23, b[2], b[3], 40); MIX2(b[0], b[3], 5, b[2], b[1], 37); MIXK(b[0], b[1], 25, b[2], b[3], 33, k[1], k[2], k[3], k[4]+1); MIX2(b[0], b[3], 46, b[2], b[1], 12); MIX2(b[0], b[1], 58, b[2], b[3], 22); MIX2(b[0], b[3], 32, b[2], b[1], 32); MIXK(b[0], b[1], 14, b[2], b[3], 16, k[2], k[3], k[4], k[0]+2); MIX2(b[0], b[3], 52, b[2], b[1], 57); MIX2(b[0], b[1], 23, b[2], b[3], 40); MIX2(b[0], b[3], 5, b[2], b[1], 37); MIXK(b[0], b[1], 25, b[2], b[3], 33, k[3], k[4], k[0], k[1]+3); MIX2(b[0], b[3], 46, b[2], b[1], 12); MIX2(b[0], b[1], 58, b[2], b[3], 22); MIX2(b[0], b[3], 32, b[2], b[1], 32); MIXK(b[0], b[1], 14, b[2], b[3], 16, k[4], k[0], k[1], k[2]+4); MIX2(b[0], b[3], 52, b[2], b[1], 57); MIX2(b[0], b[1], 23, b[2], b[3], 40); MIX2(b[0], b[3], 5, b[2], b[1], 37); for (unsigned int i=0; i<4; ++i) _o[i] = b[i] + k[i]; _o[3] += 5; } void inc_counter() { ++_s[0]; if (_s[0] != 0) return; ++_s[1]; if (_s[1] != 0) return; ++_s[2]; if (_s[2] != 0) return; ++_s[3]; } void inc_counter(uint64_t z) { if (z > 0xFFFFFFFFFFFFFFFF - _s[0]) { // check if we will overflow the first 64 bit int ++_s[1]; if (_s[1] == 0) { ++_s[2]; if (_s[2] == 0) { ++_s[3]; } } } _s[0] += z; } private: uint64_t _k[4]; // key uint64_t _s[4]; // state (counter) uint64_t _o[4]; // cipher output 4 * 64 bit = 256 bit output unsigned short _o_counter; // output chunk counter, the 256 random bits in _o // are returned in eight 32 bit chunks }; typedef prng_engine prng; typedef prng_engine sitmo; } // namespace sitmo #undef MIXK #undef MIX2 #endif sitmo/src/0000755000176200001440000000000013413722047012177 5ustar liggesuserssitmo/src/sitmo_parallel.cpp0000644000176200001440000000365713413722047015725 0ustar liggesusers#include #include // SITMO PPRNG #ifdef _OPENMP #include #endif //' Test Generation using sitmo and C++11 //' //' The function provides an implementation of creating realizations from the default engine. //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param seeds A \code{vec} containing a list of seeds. Each seed is run on its own core. //' @return A \code{vec} containing the realizations. //' @details //' The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux). //' However, it does provide a very good example as to how to make ones code applicable across multiple platforms. //' //' With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied. //' In the event that one is using OS X, only the first seed supplied is used. //' //' @export //' @examples //' a = sitmo_parallel(10, c(1)) //' //' b = sitmo_parallel(10, c(1,2)) //' //' c = sitmo_parallel(10, c(1,2)) //' //' # True on only OS X or systems without openmp //' isTRUE(all.equal(a,b)) //' //' isTRUE(all.equal(b,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_parallel(unsigned int n, Rcpp::NumericVector& seeds){ unsigned int ncores = seeds.size(); Rcpp::NumericVector q(n); #ifdef _OPENMP #pragma omp parallel num_threads(ncores) if(ncores > 1) { #endif // Engine requires uint32_t inplace of unsigned int uint32_t active_seed; // Write the active seed per core or just write one of the seeds. #ifdef _OPENMP active_seed = static_cast(seeds[omp_get_thread_num()]); #else active_seed = static_cast(seeds[0]); #endif sitmo::prng eng( active_seed ); // Parallelize the Loop #ifdef _OPENMP #pragma omp for schedule(static) #endif for (unsigned int i = 0; i < n; i++){ q[i] = eng(); } #ifdef _OPENMP } #endif return q; } sitmo/src/Makevars0000644000176200001440000000021513413722047013671 0ustar liggesusersPKG_CPPFLAGS=-I../inst/include/ PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) sitmo/src/sitmo_demo.cpp0000644000176200001440000000655313413722047015053 0ustar liggesusers#include #include // SITMO PPRNG //' Example RNG Draws with sitmo //' //' Shows a basic setup and use case for sitmo. //' //' @param n A \code{unsigned int} is a . //' @return A \code{vec} with random sequences. //' @export //' @examples //' n = 10 //' a = sitmo_draws(n) // [[Rcpp::export]] Rcpp::NumericVector sitmo_draws(unsigned int n) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng; // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i) = eng(); } return o; } //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{vector} with random sequences. //' @export //' @examples //' n = 10 //' a = sitmo_engine_seed(n, 1337) //' b = sitmo_engine_seed(n, 1337) //' c = sitmo_engine_seed(n, 1338) //' //' isTRUE(all.equal(a,b)) //' isTRUE(all.equal(a,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_engine_seed(unsigned int n, unsigned int seed) { // Create Rcpp Matrix Rcpp::NumericVector o(n); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n; ++i){ o(i) = eng(); } return o; } //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{matrix} with random sequences. //' @export //' @examples //' n = 10 //' a = sitmo_engine_reset(n, 1337) //' //' isTRUE(all.equal(a[,1],a[,2])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_engine_reset(unsigned int n, unsigned int seed) { // Create Rcpp Vector Rcpp::NumericMatrix o(n,2); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n ; ++i){ o(i,0) = eng(); } // Reset seed eng.seed(); // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i,1) = eng(); } return o; } //' Two RNG engines running side-by-side //' //' Shows how to create two separate RNGs and increase them together. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seeds A \code{vec} containing two integers greater than 0. //' @return A \code{matrix} with random sequences. //' @export //' @examples //' n = 10 //' a = sitmo_two_seeds(n, c(1337, 1338)) //' //' b = sitmo_two_seeds(n, c(1337, 1337)) //' //' isTRUE(all.equal(a[,1], a[,2])) //' //' isTRUE(all.equal(b[,1], b[,2])) //' //' isTRUE(all.equal(a[,1], b[,1])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_two_seeds(unsigned int n, Rcpp::NumericVector seeds) { if(seeds.size() != 2) Rcpp::stop("Need exactly two seeds for this example."); // Create Rcpp Matrix Rcpp::NumericMatrix o(n, 2); // Create a prng engine with a specific seed sitmo::prng eng1; eng1.seed(seeds(0)); sitmo::prng eng2; eng2.seed(seeds(1)); // Draw from base engine for (unsigned int i = 0; i < n ; ++i){ o(i,0) = eng1(); o(i,1) = eng2(); } return o; } sitmo/src/sitmo_runif.cpp0000644000176200001440000000414013413722047015240 0ustar liggesusers#include #include //' Random Uniform Number Generator with sitmo //' //' The function provides an implementation of sampling from a random uniform distribution //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param seed A special \code{unsigned integer} containing a single seed. //' @return A \code{numeric vector} containing the realizations. //' @export //' @examples //' a = runif_sitmo(10) // [[Rcpp::export]] Rcpp::NumericVector runif_sitmo(unsigned int n, double min = 0.0, double max = 1.0, uint32_t seed = 1) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng(seed); // Obtain the range between max and min double dis = max - min; for(unsigned int i = 0; i < n; ++i) { // Sample from the RNG and divide it by the maximum value possible (can also use SITMO_RAND_MAX, which is 4294967295) // Apply appropriate scale (MAX-MIN) o[i] = min + ((double) eng() / (sitmo::prng::max())) * (dis); } return o; } //' Random Uniform Number Generator using base R //' //' The function provides an alternative implementation of random uniform distribution //' sampling using R's rng scope. //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @export //' @examples //' set.seed(134) //' b = runif_r(10) // [[Rcpp::export]] Rcpp::NumericVector runif_r(unsigned int n, double min = 0.0, double max = 1.0) { Rcpp::NumericVector o(n); for(unsigned int i = 0; i < n; ++i) { o[i] = R::runif(min,max); } return o; } sitmo/src/Makevars.win0000644000176200001440000000021613413722047014466 0ustar liggesusersPKG_CPPFLAGS=-I../inst/include/ PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) sitmo/src/RcppExports.cpp0000644000176200001440000001044413413722047015177 0ustar liggesusers// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include "../inst/include/sitmo.h" #include using namespace Rcpp; // sitmo_draws Rcpp::NumericVector sitmo_draws(unsigned int n); RcppExport SEXP _sitmo_sitmo_draws(SEXP nSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); rcpp_result_gen = Rcpp::wrap(sitmo_draws(n)); return rcpp_result_gen; END_RCPP } // sitmo_engine_seed Rcpp::NumericVector sitmo_engine_seed(unsigned int n, unsigned int seed); RcppExport SEXP _sitmo_sitmo_engine_seed(SEXP nSEXP, SEXP seedSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< unsigned int >::type seed(seedSEXP); rcpp_result_gen = Rcpp::wrap(sitmo_engine_seed(n, seed)); return rcpp_result_gen; END_RCPP } // sitmo_engine_reset Rcpp::NumericMatrix sitmo_engine_reset(unsigned int n, unsigned int seed); RcppExport SEXP _sitmo_sitmo_engine_reset(SEXP nSEXP, SEXP seedSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< unsigned int >::type seed(seedSEXP); rcpp_result_gen = Rcpp::wrap(sitmo_engine_reset(n, seed)); return rcpp_result_gen; END_RCPP } // sitmo_two_seeds Rcpp::NumericMatrix sitmo_two_seeds(unsigned int n, Rcpp::NumericVector seeds); RcppExport SEXP _sitmo_sitmo_two_seeds(SEXP nSEXP, SEXP seedsSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< Rcpp::NumericVector >::type seeds(seedsSEXP); rcpp_result_gen = Rcpp::wrap(sitmo_two_seeds(n, seeds)); return rcpp_result_gen; END_RCPP } // sitmo_parallel Rcpp::NumericVector sitmo_parallel(unsigned int n, Rcpp::NumericVector& seeds); RcppExport SEXP _sitmo_sitmo_parallel(SEXP nSEXP, SEXP seedsSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< Rcpp::NumericVector& >::type seeds(seedsSEXP); rcpp_result_gen = Rcpp::wrap(sitmo_parallel(n, seeds)); return rcpp_result_gen; END_RCPP } // runif_sitmo Rcpp::NumericVector runif_sitmo(unsigned int n, double min, double max, uint32_t seed); RcppExport SEXP _sitmo_runif_sitmo(SEXP nSEXP, SEXP minSEXP, SEXP maxSEXP, SEXP seedSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< double >::type min(minSEXP); Rcpp::traits::input_parameter< double >::type max(maxSEXP); Rcpp::traits::input_parameter< uint32_t >::type seed(seedSEXP); rcpp_result_gen = Rcpp::wrap(runif_sitmo(n, min, max, seed)); return rcpp_result_gen; END_RCPP } // runif_r Rcpp::NumericVector runif_r(unsigned int n, double min, double max); RcppExport SEXP _sitmo_runif_r(SEXP nSEXP, SEXP minSEXP, SEXP maxSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type n(nSEXP); Rcpp::traits::input_parameter< double >::type min(minSEXP); Rcpp::traits::input_parameter< double >::type max(maxSEXP); rcpp_result_gen = Rcpp::wrap(runif_r(n, min, max)); return rcpp_result_gen; END_RCPP } static const R_CallMethodDef CallEntries[] = { {"_sitmo_sitmo_draws", (DL_FUNC) &_sitmo_sitmo_draws, 1}, {"_sitmo_sitmo_engine_seed", (DL_FUNC) &_sitmo_sitmo_engine_seed, 2}, {"_sitmo_sitmo_engine_reset", (DL_FUNC) &_sitmo_sitmo_engine_reset, 2}, {"_sitmo_sitmo_two_seeds", (DL_FUNC) &_sitmo_sitmo_two_seeds, 2}, {"_sitmo_sitmo_parallel", (DL_FUNC) &_sitmo_sitmo_parallel, 2}, {"_sitmo_runif_sitmo", (DL_FUNC) &_sitmo_runif_sitmo, 4}, {"_sitmo_runif_r", (DL_FUNC) &_sitmo_runif_r, 3}, {NULL, NULL, 0} }; RcppExport void R_init_sitmo(DllInfo *dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); } sitmo/NAMESPACE0000644000176200001440000000041213413720552012623 0ustar liggesusers# Generated by roxygen2: do not edit by hand export(runif_r) export(runif_sitmo) export(sitmo_draws) export(sitmo_engine_reset) export(sitmo_engine_seed) export(sitmo_parallel) export(sitmo_two_seeds) importFrom(Rcpp,sourceCpp) useDynLib(sitmo, .registration=TRUE) sitmo/NEWS.md0000644000176200001440000000430413413721146012506 0ustar liggesusers# sitmo 2.0.1 ## CHANGES - Modified `vandercorput.h` by adding a newline to the end of the file. - Modified `Makevars{.win}` to use `$(SHLIB_OPENMP_CXXFLAGS)` instead of `$(SHLIB_OPENMP_CFLAGS)` in `PKG_CXXFLAGS` ## TESTING INFRASTRUCTURE - Modified `.travis.yml` to compile using both cores instead of only one. # sitmo 2.0.0 ## NEW - Added `threefry` and `vandercorput` (#9, #10). - Added contributor Ralf Stubner (@rstub) ## CHANGES - Modified `threefry` to be fully _C++11_ compliant. (#11, @rstub) - Removed the `Rcpp.plugin.maker()` # sitmo 1.2.2 ## BUGFIXES - Addressed import of `Rcpp.plugin.maker()` by using the _exported_ variable name, e.g. `::`, in place of the _internal_ variable name, e.g. `:::` (#7). - Updated `sitmo` URL to point to `stdfin/random` (#8). # sitmo 1.2.1 ## BUGFIXES - Removed extra ; in sitmo header to quiet compile warnings (#4, thanks @helske) - Updated `sitmo_two_seeds()` src and documentation in "Deployment of `sitmo` within C++ Code" so that it uses the second seed for eng2 and returns an n x 2 matrix instead of n x 3. (#5, thanks @helske) # sitmo 1.2.0 ## CHANGES - Added plugin registration for `Rcpp:::Rcpp.plugin.maker()` (#3) - Added `CxxFlags()` and `sitmoCxxFlags()` functions to display `CXX_FLAGS` required by `sitmo`. (#3) - Updated examples in README.Rmd and SITMO internal vignette to use the Rcpp depends attribute. (#3) ## BUGFIXES - Corrected a signed and unsigned integer comparison in "Making a Uniform PRNG with `sitmo`" vignette. - Fixed notation in "Making a Uniform PRNG with `sitmo`" vignette. # sitmo 1.1.0 ## CHANGES - Added `src/init.c` to address R 3.4 C++ registration requirement (#2) - Clarified content in "Making a Uniform PRNG with `sitmo`" vignette. ## BUG FIXES - Addressed signed and unsigned integer comparison in sitmo header (#1) - Corrected a URL that was problematic in "Deployment of `sitmo` within C++ Code" vignette. # sitmo 1.0.0 ## NEW - Embedded `sitmo` header file in an R package. - Provided code examples using `sitmo` header file. - Released three vignettes detailing `sitmo` contents: - Deployment of `sitmo` within C++ Code - Making a Uniform PRNG with `sitmo` - `sitmo`'s BigCrush Results sitmo/R/0000755000176200001440000000000013314703517011612 5ustar liggesuserssitmo/R/RcppExports.R0000644000176200001440000001126513204107660014226 0ustar liggesusers# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Example RNG Draws with sitmo #' #' Shows a basic setup and use case for sitmo. #' #' @param n A \code{unsigned int} is a . #' @return A \code{vec} with random sequences. #' @export #' @examples #' n = 10 #' a = sitmo_draws(n) sitmo_draws <- function(n) { .Call(`_sitmo_sitmo_draws`, n) } #' Example Seed Set and RNG Draws with sitmo #' #' Shows how to set a seed in sitmo. #' #' @param n An \code{unsigned int} that dictates how many realizations occur. #' @param seed An \code{unsigned int} that controls the rng seed. #' @return A \code{vector} with random sequences. #' @export #' @examples #' n = 10 #' a = sitmo_engine_seed(n, 1337) #' b = sitmo_engine_seed(n, 1337) #' c = sitmo_engine_seed(n, 1338) #' #' isTRUE(all.equal(a,b)) #' isTRUE(all.equal(a,c)) sitmo_engine_seed <- function(n, seed) { .Call(`_sitmo_sitmo_engine_seed`, n, seed) } #' Example Seed Set and RNG Draws with sitmo #' #' Shows how to set a seed in sitmo. #' #' @param n An \code{unsigned int} that dictates how many realizations occur. #' @param seed An \code{unsigned int} that controls the rng seed. #' @return A \code{matrix} with random sequences. #' @export #' @examples #' n = 10 #' a = sitmo_engine_reset(n, 1337) #' #' isTRUE(all.equal(a[,1],a[,2])) sitmo_engine_reset <- function(n, seed) { .Call(`_sitmo_sitmo_engine_reset`, n, seed) } #' Two RNG engines running side-by-side #' #' Shows how to create two separate RNGs and increase them together. #' #' @param n An \code{unsigned int} that dictates how many realizations occur. #' @param seeds A \code{vec} containing two integers greater than 0. #' @return A \code{matrix} with random sequences. #' @export #' @examples #' n = 10 #' a = sitmo_two_seeds(n, c(1337, 1338)) #' #' b = sitmo_two_seeds(n, c(1337, 1337)) #' #' isTRUE(all.equal(a[,1], a[,2])) #' #' isTRUE(all.equal(b[,1], b[,2])) #' #' isTRUE(all.equal(a[,1], b[,1])) sitmo_two_seeds <- function(n, seeds) { .Call(`_sitmo_sitmo_two_seeds`, n, seeds) } #' Test Generation using sitmo and C++11 #' #' The function provides an implementation of creating realizations from the default engine. #' #' @param n An \code{unsigned integer} denoting the number of realizations to generate. #' @param seeds A \code{vec} containing a list of seeds. Each seed is run on its own core. #' @return A \code{vec} containing the realizations. #' @details #' The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux). #' However, it does provide a very good example as to how to make ones code applicable across multiple platforms. #' #' With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied. #' In the event that one is using OS X, only the first seed supplied is used. #' #' @export #' @examples #' a = sitmo_parallel(10, c(1)) #' #' b = sitmo_parallel(10, c(1,2)) #' #' c = sitmo_parallel(10, c(1,2)) #' #' # True on only OS X or systems without openmp #' isTRUE(all.equal(a,b)) #' #' isTRUE(all.equal(b,c)) sitmo_parallel <- function(n, seeds) { .Call(`_sitmo_sitmo_parallel`, n, seeds) } #' Random Uniform Number Generator with sitmo #' #' The function provides an implementation of sampling from a random uniform distribution #' #' @param n An \code{unsigned integer} denoting the number of realizations to generate. #' @param min A \code{double} indicating the minimum \eqn{a} value #' in the uniform's interval \eqn{\left[a,b\right]} #' @param max A \code{double} indicating the maximum \eqn{b} value #' in the uniform's interval \eqn{\left[a,b\right]} #' @param seed A special \code{unsigned integer} containing a single seed. #' @return A \code{numeric vector} containing the realizations. #' @export #' @examples #' a = runif_sitmo(10) runif_sitmo <- function(n, min = 0.0, max = 1.0, seed = 1L) { .Call(`_sitmo_runif_sitmo`, n, min, max, seed) } #' Random Uniform Number Generator using base R #' #' The function provides an alternative implementation of random uniform distribution #' sampling using R's rng scope. #' @param n An \code{unsigned integer} denoting the number of realizations to generate. #' @param min A \code{double} indicating the minimum \eqn{a} value #' in the uniform's interval \eqn{\left[a,b\right]} #' @param max A \code{double} indicating the maximum \eqn{b} value #' in the uniform's interval \eqn{\left[a,b\right]} #' @export #' @examples #' set.seed(134) #' b = runif_r(10) runif_r <- function(n, min = 0.0, max = 1.0) { .Call(`_sitmo_runif_r`, n, min, max) } sitmo/R/sitmo-package.r0000644000176200001440000000012113204107660014506 0ustar liggesusers#' @useDynLib sitmo, .registration=TRUE #' @importFrom Rcpp sourceCpp "_PACKAGE" sitmo/vignettes/0000755000176200001440000000000013413722047013420 5ustar liggesuserssitmo/vignettes/big_crush_test.Rmd0000644000176200001440000027626013204107660017101 0ustar liggesusers--- title: "`sitmo`'s BigCrush Results" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{`sitmo`'s BigCrush Results} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- # Introduction [TestU01](http://www.iro.umontreal.ca/~simardr/testu01/tu01.html) is a software library produced by Pierre L'Ecuyer and Richard Simard written in C that provides a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs). The suite is able to provide information on the quality of the randomness a psuedo-random number generator can produce. It is able to do so under four different branches: * Implementing (pre-programmed) RNGs; * implementing specific statistical tests; * implementing batteries of statistical tests; and * Applying tests to entire families of RNGs. [TestU01](http://www.iro.umontreal.ca/~simardr/testu01/tu01.html) offers several batteries of tests including "Small Crush" (which consists of 10 tests), "Crush" (96 tests), and "Big Crush" (106 tests). With the later test being more extensive than the previous ones. For more information about the tests available, please consult the [TestU01 userguide](http://www.iro.umontreal.ca/~simardr/testu01/guideshorttestu01.pdf). The results of the "Big Crush" test are presented next. # Results of the Test Running the Big Crush test from the TestU01 suite has yielded a complete pass rate (e.g "All tests were passed") with the specifics of each of the 103 tests being detailed below. ```{r eval = F, engine='bash'} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Starting BigCrush Version: TestU01 1.2.3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *********************************************************** Test smarsa_SerialOver calling smultin_MultinomialOver *********************************************************** HOST = Sitmos-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 1, n = 1000000000, r = 0, d = 256, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 16777216 Expected number per cell = 59.604645 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0083558402, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 16711680 Value of the statistic : 1.67e+7 p-value of test : 0.59 ----------------------------------------------- CPU time used : 00:01:04.53 Generator state: *********************************************************** Test smarsa_SerialOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 1, n = 1000000000, r = 22, d = 256, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 16777216 Expected number per cell = 59.604645 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0083558402, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 16711680 Value of the statistic : 1.67e+7 p-value of test : 0.42 ----------------------------------------------- CPU time used : 00:01:08.78 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 2097152, t = 2, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1445 p-value of test : 0.02 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334565 j = 1 : 599997110 j = 2 : 1445 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:03:49.93 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 9, d = 2097152, t = 2, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1294 p-value of test : 0.97 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334414 j = 1 : 599997412 j = 2 : 1294 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:03:44.17 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 16384, t = 3, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1341 p-value of test : 0.73 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334461 j = 1 : 599997318 j = 2 : 1341 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:43.85 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 16, d = 16384, t = 3, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1401 p-value of test : 0.16 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334521 j = 1 : 599997198 j = 2 : 1401 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:38.33 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 64, t = 7, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1363 p-value of test : 0.51 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334483 j = 1 : 599997274 j = 2 : 1363 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:45.35 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 24, d = 64, t = 7, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1312 p-value of test : 0.92 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334432 j = 1 : 599997376 j = 2 : 1312 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:41.50 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 8, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1373 p-value of test : 0.41 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334493 j = 1 : 599997254 j = 2 : 1373 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:45.18 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 27, d = 8, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1360 p-value of test : 0.54 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334480 j = 1 : 599997280 j = 2 : 1360 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:41.13 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 0, d = 4, t = 21, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1355 p-value of test : 0.59 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334475 j = 1 : 599997290 j = 2 : 1355 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:43.98 Generator state: *********************************************************** Test smarsa_CollisionOver calling smultin_MultinomialOver *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_MultinomialOver test: ----------------------------------------------- N = 30, n = 20000000, r = 28, d = 4, t = 21, Sparse = TRUE GenerCell = smultin_GenerCellSerial Number of cells = d^t = 4398046511104 Expected number per cell = 1 / 219902.33 EColl = n^2 / (2k) = 45.47473509 Hashing = TRUE Collision test CollisionOver: density = n / k = 1 / 219902.33 Expected number of collisions = Mu = 45.47 ----------------------------------------------- Results of CollisionOver test: POISSON approximation : Expected number of collisions = N*Mu : 1364.24 Observed number of collisions : 1387 p-value of test : 0.27 ----------------------------- Total number of cells containing j balls j = 0 : 131940795334507 j = 1 : 599997226 j = 2 : 1387 j = 3 : 0 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:39.21 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 100, n = 10000000, r = 0, d = 2147483648, t = 2, p = 1 Number of cells = d^t = 4611686018427387904 Lambda = Poisson mean = 54.2101 ---------------------------------------------------- Total expected number = N*Lambda : 5421.01 Total observed number : 5379 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:03:58.55 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 0, d = 2097152, t = 3, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4347 p-value of test : 0.44 ----------------------------------------------- CPU time used : 00:01:44.53 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 14, d = 65536, t = 4, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7383 p-value of test : 0.23 ----------------------------------------------- CPU time used : 00:02:48.51 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 0, d = 512, t = 7, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4299 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:59.94 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 20000000, r = 7, d = 512, t = 7, p = 1 Number of cells = d^t = 9223372036854775808 Lambda = Poisson mean = 216.8404 ---------------------------------------------------- Total expected number = N*Lambda : 4336.81 Total observed number : 4377 p-value of test : 0.27 ----------------------------------------------- CPU time used : 00:02:05.76 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 14, d = 256, t = 8, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7325 p-value of test : 0.47 ----------------------------------------------- CPU time used : 00:03:19.07 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 22, d = 256, t = 8, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7294 p-value of test : 0.61 ----------------------------------------------- CPU time used : 00:03:19.19 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 0, d = 16, t = 16, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7366 p-value of test : 0.29 ----------------------------------------------- CPU time used : 00:04:00.28 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_BirthdaySpacings test: ----------------------------------------------- N = 20, n = 30000000, r = 26, d = 16, t = 16, p = 1 Number of cells = d^t = 18446744073709551616 Lambda = Poisson mean = 365.9182 ---------------------------------------------------- Total expected number = N*Lambda : 7318.36 Total observed number : 7357 p-value of test : 0.33 ----------------------------------------------- CPU time used : 00:04:19.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 30, n = 6000000, r = 0, t = 3, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 0.30 p-value of test : 0.93 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.55 p-value of test : 0.69 Test on the Nm values of W_{n,i}(mNP1): 1.63 p-value of test : 0.15 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 900 Number of jumps of Y : 970 p-value of test : 0.01 Stat. AD (mNP2) : 1.27 p-value of test : 0.24 Stat. AD after spacings (mNP2-S) : 1.48 p-value of test : 0.18 ----------------------------------------------- CPU time used : 00:02:35.76 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 20, n = 4000000, r = 0, t = 5, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 1.33 p-value of test : 0.22 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.58 p-value of test : 0.67 Test on the Nm values of W_{n,i}(mNP1): 0.76 p-value of test : 0.51 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 600 Number of jumps of Y : 577 p-value of test : 0.82 Stat. AD (mNP2) : 1.31 p-value of test : 0.23 Stat. AD after spacings (mNP2-S) : 0.81 p-value of test : 0.48 ----------------------------------------------- CPU time used : 00:01:45.47 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 10, n = 3000000, r = 0, t = 9, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 0.52 p-value of test : 0.73 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.29 p-value of test : 0.94 Test on the Nm values of W_{n,i}(mNP1): 1.48 p-value of test : 0.18 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 300 Number of jumps of Y : 260 p-value of test : 0.99 Stat. AD (mNP2) : 0.71 p-value of test : 0.55 Stat. AD after spacings (mNP2-S) : 0.62 p-value of test : 0.63 ----------------------------------------------- CPU time used : 00:02:55.40 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo snpair_ClosePairs test: ----------------------------------------------- N = 5, n = 2000000, r = 0, t = 16, p = 0, m = 30, Torus = TRUE --------------------------------------- Test based on the 2 nearest points (NP): Stat. AD on the N values (NP) : 1.24 p-value of test : 0.25 A2 test based on the spacings between the successive jump times of process Y_n(t): A2 test on the values of A2 (m-NP) : 0.54 p-value of test : 0.70 Test on the Nm values of W_{n,i}(mNP1): 1.31 p-value of test : 0.23 Test on the jump times of Y (superposition of Yn): Expected number of jumps of Y = mN : 150 Number of jumps of Y : 150 p-value of test : 0.51 Stat. AD (mNP2) : 3.70 p-value of test : 0.01 Stat. AD after spacings (mNP2-S) : 0.89 p-value of test : 0.42 ----------------------------------------------- CPU time used : 00:03:22.78 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 400000000, r = 0, d = 8, k = 8 ----------------------------------------------- Number of degrees of freedom : 7 Chi-square statistic : 5.92 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:00:59.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 400000000, r = 27, d = 8, k = 8 ----------------------------------------------- Number of degrees of freedom : 7 Chi-square statistic : 3.46 p-value of test : 0.84 ----------------------------------------------- CPU time used : 00:01:09.35 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 100000000, r = 0, d = 32, k = 32 ----------------------------------------------- Number of degrees of freedom : 18 Chi-square statistic : 9.52 p-value of test : 0.95 ----------------------------------------------- CPU time used : 00:01:02.60 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_SimpPoker test: ----------------------------------------------- N = 1, n = 100000000, r = 25, d = 32, k = 32 ----------------------------------------------- Number of degrees of freedom : 18 Chi-square statistic : 14.29 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:13.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 0, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 44.18 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:01:16.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 10, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 47.86 p-value of test : 0.71 ----------------------------------------------- CPU time used : 00:01:28.55 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 20, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 50.86 p-value of test : 0.60 ----------------------------------------------- CPU time used : 00:01:28.60 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_CouponCollector test: ----------------------------------------------- N = 1, n = 200000000, r = 27, d = 8 ----------------------------------------------- Number of degrees of freedom : 54 Chi-square statistic : 58.93 p-value of test : 0.30 ----------------------------------------------- CPU time used : 00:01:28.68 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 500000000, r = 0, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 232 Chi-square statistic : 214.26 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:01:32.96 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 300000000, r = 25, Alpha = 0, Beta = 0.03125 ----------------------------------------------- Number of degrees of freedom : 434 Chi-square statistic : 397.76 p-value of test : 0.89 ----------------------------------------------- CPU time used : 00:02:06.14 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 100000000, r = 0, Alpha = 0, Beta = 0.0078125 ----------------------------------------------- Number of degrees of freedom : 1437 Chi-square statistic : 1481.41 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:02:13.51 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Gap test: ----------------------------------------------- N = 1, n = 10000000, r = 20, Alpha = 0, Beta = 0.000976562 ----------------------------------------------- Number of degrees of freedom : 7046 Chi-square statistic : 7166.64 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:02:08.09 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Run test: ----------------------------------------------- N = 5, n = 1000000000, r = 0, Up = FALSE ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.50 p-value of test : 0.05 Kolmogorov-Smirnov- statistic = D- : 0.14 p-value of test : 0.77 Anderson-Darling statistic = A2 : 2.25 p-value of test : 0.07 Test on the sum of all N observations Number of degrees of freedom : 30 Chi-square statistic : 22.54 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:01:23.93 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_Run test: ----------------------------------------------- N = 10, n = 1000000000, r = 15, Up = TRUE ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.21 p-value of test : 0.35 Kolmogorov-Smirnov- statistic = D- : 0.15 p-value of test : 0.59 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 60 Chi-square statistic : 58.53 p-value of test : 0.53 ----------------------------------------------- CPU time used : 00:03:11.42 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 1000000000, r = 5, t = 3, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 6 Expected number per cell = 1.6666667e+08 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 2.5000002e-09, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 5 Value of the statistic : 8.17 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:00:46.93 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 1000000000, r = 5, t = 5, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 120 Expected number per cell = 8333333.3 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 5.9500005e-08, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 119 Value of the statistic : 108.58 p-value of test : 0.74 ----------------------------------------------- CPU time used : 00:01:35.02 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 500000000, r = 5, t = 7, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 5040 Expected number per cell = 99206.349 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 5.0390004e-06, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 5039 Value of the statistic : 4810.30 p-value of test : 0.99 ----------------------------------------------- CPU time used : 00:01:24.63 Generator state: *********************************************************** Test sknuth_Permutation calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 1, n = 500000000, r = 10, t = 10, Sparse = FALSE GenerCell = smultin_GenerCellPermut Number of cells = t! = 3628800 Expected number per cell = 137.7866 Hashing = FALSE For Delta > -1, we use the ChiSquare approximation Correction factor of the ChiSquare: Delta = 1, Mu = 0.0036287993, Sigma = 1 ----------------------------------------------- Test Results for Delta = 1.0000 Number of degrees of freedom : 3628799 Value of the statistic : 3.63e+6 p-value of test : 0.80 ----------------------------------------------- CPU time used : 00:03:06.50 Generator state: *********************************************************** Test sknuth_CollisionPermut calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 20, n = 20000000, r = 0, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellPermut Number of cells = t! = 87178291200 Expected number per cell = 1 / 4358.9146 EColl = n^2 / (2k) = 2294.14912 Hashing = TRUE Collision test, Mu = 2293.9736, Sigma = 47.8841 ----------------------------------------------- Test Results for Collisions For the total number of collisions, we use the Poisson approximation: Expected number of collisions = N*Mu : 45879.47 Observed number of collisions : 45892 p-value of test : 0.48 ----------------------------- Total number of cells containing j balls j = 0 : 1743165869892 j = 1 : 399908218 j = 2 : 45888 j = 3 : 2 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:04:54.47 Generator state: *********************************************************** Test sknuth_CollisionPermut calling smultin_Multinomial *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smultin_Multinomial test: ----------------------------------------------- N = 20, n = 20000000, r = 10, t = 14, Sparse = TRUE GenerCell = smultin_GenerCellPermut Number of cells = t! = 87178291200 Expected number per cell = 1 / 4358.9146 EColl = n^2 / (2k) = 2294.14912 Hashing = TRUE Collision test, Mu = 2293.9736, Sigma = 47.8841 ----------------------------------------------- Test Results for Collisions For the total number of collisions, we use the Poisson approximation: Expected number of collisions = N*Mu : 45879.47 Observed number of collisions : 45960 p-value of test : 0.35 ----------------------------- Total number of cells containing j balls j = 0 : 1743165869960 j = 1 : 399908084 j = 2 : 45952 j = 3 : 4 j = 4 : 0 j = 5 : 0 ----------------------------------------------- CPU time used : 00:05:01.14 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 40, n = 10000000, r = 0, d = 100000, t = 8 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.11 p-value of test : 0.35 Kolmogorov-Smirnov- statistic = D- : 0.036 p-value of test : 0.88 Anderson-Darling statistic = A2 : 0.61 p-value of test : 0.64 Test on the sum of all N observations Number of degrees of freedom : 3999960 Chi-square statistic : 4.00e+6 p-value of test : 0.77 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.091 p-value of test : 0.49 Kolmogorov-Smirnov- statistic = D- : 0.054 p-value of test : 0.77 Anderson-Darling statistic = A2 : 0.41 p-value of test : 0.84 ----------------------------------------------- CPU time used : 00:01:45.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 30, n = 10000000, r = 0, d = 100000, t = 16 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.13 p-value of test : 0.32 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.17 Anderson-Darling statistic = A2 : 1.26 p-value of test : 0.25 Test on the sum of all N observations Number of degrees of freedom : 2999970 Chi-square statistic : 3.00e+6 p-value of test : 0.40 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.19 p-value of test : 0.11 Kolmogorov-Smirnov- statistic = D- : 0.014 p-value of test : 0.98 Anderson-Darling statistic = A2 : 1.61 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:01:43.48 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 20, n = 10000000, r = 0, d = 100000, t = 24 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.15 p-value of test : 0.38 Kolmogorov-Smirnov- statistic = D- : 0.12 p-value of test : 0.54 Anderson-Darling statistic = A2 : 0.55 p-value of test : 0.69 Test on the sum of all N observations Number of degrees of freedom : 1999980 Chi-square statistic : 2.00e+6 p-value of test : 0.64 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.040 p-value of test : 0.91 Kolmogorov-Smirnov- statistic = D- : 0.19 p-value of test : 0.23 Anderson-Darling statistic = A2 : 0.94 p-value of test : 0.39 ----------------------------------------------- CPU time used : 00:01:27.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sknuth_MaxOft test: ----------------------------------------------- N = 20, n = 10000000, r = 0, d = 100000, t = 32 Number of categories = 100000 Expected number per category = 100.00 ----------------------------------------------- Test results for chi2 with 99999 degrees of freedom: Kolmogorov-Smirnov+ statistic = D+ : 0.12 p-value of test : 0.51 Kolmogorov-Smirnov- statistic = D- : 0.100 p-value of test : 0.63 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 1999980 Chi-square statistic : 2.00e+6 p-value of test : 0.64 ----------------------------------------------- Test results for Anderson-Darling: Kolmogorov-Smirnov+ statistic = D+ : 0.10 p-value of test : 0.61 Kolmogorov-Smirnov- statistic = D- : 0.16 p-value of test : 0.33 Anderson-Darling statistic = A2 : 0.79 p-value of test : 0.48 ----------------------------------------------- CPU time used : 00:01:43.31 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 40, n = 10000000, r = 0, t = 8 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.18 p-value of test : 0.06 Kolmogorov-Smirnov- statistic = D- : 0.049 p-value of test : 0.80 Anderson-Darling statistic = A2 : 1.90 p-value of test : 0.10 ----------------------------------------------- CPU time used : 00:01:54.64 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 20, n = 10000000, r = 0, t = 16 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.24 p-value of test : 0.08 Kolmogorov-Smirnov- statistic = D- : 0.043 p-value of test : 0.90 Anderson-Darling statistic = A2 : 2.22 p-value of test : 0.07 ----------------------------------------------- CPU time used : 00:01:29.65 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleProd test: ----------------------------------------------- N = 20, n = 10000000, r = 0, t = 24 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.23 p-value of test : 0.10 Kolmogorov-Smirnov- statistic = D- : 0.012 p-value of test : 0.98 Anderson-Darling statistic = A2 : 1.69 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:02:04.43 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleMean test: ----------------------------------------------- N = 20000000, n = 30, r = 0 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 1.93e-4 p-value of test : 0.22 Kolmogorov-Smirnov- statistic = D- : 7.01e-5 p-value of test : 0.82 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 ----------------------------------------------- CPU time used : 00:00:15.09 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleMean test: ----------------------------------------------- N = 20000000, n = 30, r = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 1.37e-4 p-value of test : 0.47 Kolmogorov-Smirnov- statistic = D- : 1.31e-4 p-value of test : 0.50 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.76 ----------------------------------------------- CPU time used : 00:00:15.52 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleCorr test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, k = 1 ----------------------------------------------- Normal statistic : -1.75 p-value of test : 0.96 ----------------------------------------------- CPU time used : 00:00:23.87 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SampleCorr test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, k = 2 ----------------------------------------------- Normal statistic : 1.09 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:00:23.96 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_AppearanceSpacings test: ----------------------------------------------- N = 1, Q = 10000000, K = 1000000000, r = 0, s = 3, L = 15 Sequences of n = (K + Q)L = 15150000000 bits Q = 10000000 initialization blocks K = 1000000000 blocks for the test the blocks have L = 15 bits ----------------------------------------------- Normal statistic : -0.31 p-value of test : 0.62 ----------------------------------------------- CPU time used : 00:01:09.11 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_AppearanceSpacings test: ----------------------------------------------- N = 1, Q = 10000000, K = 1000000000, r = 27, s = 3, L = 15 Sequences of n = (K + Q)L = 15150000000 bits Q = 10000000 initialization blocks K = 1000000000 blocks for the test the blocks have L = 15 bits ----------------------------------------------- Normal statistic : -0.77 p-value of test : 0.78 ----------------------------------------------- CPU time used : 00:01:12.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 0, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 53.51 p-value of test : 0.88 ----------------------------------------------- CPU time used : 00:00:53.06 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 20, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 76.46 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:01:05.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 28, k = 256, Alpha = 0, Beta = 0.25 ----------------------------------------------- Number of degrees of freedom : 67 Chi-square statistic : 66.46 p-value of test : 0.50 ----------------------------------------------- CPU time used : 00:01:05.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 0, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 32.57 p-value of test : 0.68 ----------------------------------------------- CPU time used : 00:00:53.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 10, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 53.95 p-value of test : 0.04 ----------------------------------------------- CPU time used : 00:01:05.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_WeightDistrib test: ----------------------------------------------- N = 1, n = 20000000, r = 26, k = 256, Alpha = 0, Beta = 0.0625 ----------------------------------------------- Number of degrees of freedom : 37 Chi-square statistic : 18.95 p-value of test : 0.9939 ----------------------------------------------- CPU time used : 00:01:05.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo svaria_SumCollector test: ----------------------------------------------- N = 1, n = 500000000, r = 0, g = 10 ----------------------------------------------- Number of degrees of freedom : 29 Chi-square statistic : 22.00 p-value of test : 0.82 ----------------------------------------------- CPU time used : 00:01:58.36 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 10, n = 1000000, r = 0, s = 5, L = 30, k = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.27 p-value of test : 0.19 Kolmogorov-Smirnov- statistic = D- : 0.16 p-value of test : 0.56 Anderson-Darling statistic = A2 : 0.78 p-value of test : 0.50 Test on the sum of all N observations Number of degrees of freedom : 40 Chi-square statistic : 32.66 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:01:16.26 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 10, n = 1000000, r = 25, s = 5, L = 30, k = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.19 p-value of test : 0.42 Kolmogorov-Smirnov- statistic = D- : 0.14 p-value of test : 0.62 Anderson-Darling statistic = A2 : 0.49 p-value of test : 0.75 Test on the sum of all N observations Number of degrees of freedom : 40 Chi-square statistic : 34.46 p-value of test : 0.72 ----------------------------------------------- CPU time used : 00:01:16.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 5000, r = 0, s = 4, L = 1000, k = 1000 ----------------------------------------------- Number of degrees of freedom : 3 Chi-square statistic : 0.73 p-value of test : 0.87 ----------------------------------------------- CPU time used : 00:03:44.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 5000, r = 26, s = 4, L = 1000, k = 1000 ----------------------------------------------- Number of degrees of freedom : 3 Chi-square statistic : 1.12 p-value of test : 0.77 ----------------------------------------------- CPU time used : 00:03:44.77 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 80, r = 15, s = 15, L = 5000, k = 5000 ----------------------------------------------- Number of degrees of freedom : 2 Chi-square statistic : 6.04 p-value of test : 0.05 ----------------------------------------------- CPU time used : 00:03:28.23 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_MatrixRank test: ----------------------------------------------- N = 1, n = 80, r = 0, s = 30, L = 5000, k = 5000 ----------------------------------------------- Number of degrees of freedom : 2 Chi-square statistic : 0.075 p-value of test : 0.96 ----------------------------------------------- CPU time used : 00:02:51.20 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_Savir2 test: ----------------------------------------------- N = 10, n = 10000000, r = 10, m = 1048576, t = 30 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.027 p-value of test : 0.97 Kolmogorov-Smirnov- statistic = D- : 0.41 p-value of test : 0.02 Anderson-Darling statistic = A2 : 2.58 p-value of test : 0.05 Test on the sum of all N observations Number of degrees of freedom : 130 Chi-square statistic : 164.06 p-value of test : 0.02 ----------------------------------------------- CPU time used : 00:00:37.67 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo smarsa_GCD test: ----------------------------------------------- N = 10, n = 50000000, r = 0, s = 30 ----------------------------------------------- Test results for GCD values: Kolmogorov-Smirnov+ statistic = D+ : 0.34 p-value of test : 0.08 Kolmogorov-Smirnov- statistic = D- : 0.026 p-value of test : 0.97 Anderson-Darling statistic = A2 : 1.62 p-value of test : 0.15 Test on the sum of all N observations Number of degrees of freedom : 17430 Chi-square statistic :17122.72 p-value of test : 0.95 ----------------------------------------------- CPU time used : 00:01:54.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 100000000, r = 0, s = 5, L0 = 50, L1 = 50 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 36 ChiSquare statistic : 30.27 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 35 ChiSquare statistic : 34.79 p-value of test : 0.48 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 25 ChiSquare statistic : 34.88 p-value of test : 0.09 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 24 ChiSquare statistic : 25.02 p-value of test : 0.40 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 17 ChiSquare statistic : 24.18 p-value of test : 0.11 ----------------------------------------------- CPU time used : 00:00:47.70 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 100000000, r = 25, s = 5, L0 = 50, L1 = 50 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 36 ChiSquare statistic : 26.87 p-value of test : 0.86 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 35 ChiSquare statistic : 25.33 p-value of test : 0.89 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 25 ChiSquare statistic : 40.08 p-value of test : 0.03 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 24 ChiSquare statistic : 19.29 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 17 ChiSquare statistic : 11.45 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:00:48.73 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 10000000, r = 0, s = 10, L0 = 1000, L1 = 1000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 146 ChiSquare statistic : 177.55 p-value of test : 0.04 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 146 ChiSquare statistic : 117.36 p-value of test : 0.96 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 500 ChiSquare statistic : 438.13 p-value of test : 0.98 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 136 ChiSquare statistic : 119.76 p-value of test : 0.84 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 74 ChiSquare statistic : 86.45 p-value of test : 0.15 ----------------------------------------------- CPU time used : 00:01:06.36 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 10000000, r = 20, s = 10, L0 = 1000, L1 = 1000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 146 ChiSquare statistic : 128.52 p-value of test : 0.85 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 146 ChiSquare statistic : 139.85 p-value of test : 0.63 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 500 ChiSquare statistic : 509.00 p-value of test : 0.38 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 136 ChiSquare statistic : 125.25 p-value of test : 0.74 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 74 ChiSquare statistic : 68.45 p-value of test : 0.66 ----------------------------------------------- CPU time used : 00:01:08.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 1000000, r = 0, s = 15, L0 = 10000, L1 = 10000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 384 ChiSquare statistic : 396.65 p-value of test : 0.32 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 384 ChiSquare statistic : 387.98 p-value of test : 0.43 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 5000 ChiSquare statistic : 4987.07 p-value of test : 0.55 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 378 ChiSquare statistic : 370.70 p-value of test : 0.60 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 200 ChiSquare statistic : 202.48 p-value of test : 0.44 ----------------------------------------------- CPU time used : 00:00:57.94 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo swalk_RandomWalk1 test: ----------------------------------------------- N = 1, n = 1000000, r = 15, s = 15, L0 = 10000, L1 = 10000 ----------------------------------------------- Test on the values of the Statistic H Number of degrees of freedom : 384 ChiSquare statistic : 370.10 p-value of test : 0.69 ----------------------------------------------- Test on the values of the Statistic M Number of degrees of freedom : 384 ChiSquare statistic : 369.10 p-value of test : 0.70 ----------------------------------------------- Test on the values of the Statistic J Number of degrees of freedom : 5000 ChiSquare statistic : 4890.41 p-value of test : 0.86 ----------------------------------------------- Test on the values of the Statistic R Number of degrees of freedom : 378 ChiSquare statistic : 357.68 p-value of test : 0.77 ----------------------------------------------- Test on the values of the Statistic C Number of degrees of freedom : 200 ChiSquare statistic : 180.54 p-value of test : 0.83 ----------------------------------------------- CPU time used : 00:00:58.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LinearComp test: ----------------------------------------------- N = 1, n = 400020, r = 0, s = 1 ----------------------------------------------- Number of degrees of freedom : 12 Chi2 statistic for size of jumps : 12.60 p-value of test : 0.40 ----------------------------------------------- Normal statistic for number of jumps : 2.51 p-value of test : 6.1e-3 ----------------------------------------------- CPU time used : 00:02:43.68 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LinearComp test: ----------------------------------------------- N = 1, n = 400020, r = 29, s = 1 ----------------------------------------------- Number of degrees of freedom : 12 Chi2 statistic for size of jumps : 8.18 p-value of test : 0.77 ----------------------------------------------- Normal statistic for number of jumps : -1.55 p-value of test : 0.94 ----------------------------------------------- CPU time used : 00:02:43.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LempelZiv test: ----------------------------------------------- N = 10, n = 134217728, r = 0, s = 30, k = 27 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.23 p-value of test : 0.31 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.65 Anderson-Darling statistic = A2 : 0.54 p-value of test : 0.70 Tests on the sum of all N observations Standardized normal statistic : -0.32 p-value of test : 0.63 Sample variance : 1.17 p-value of test : 0.31 ----------------------------------------------- CPU time used : 00:00:54.70 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo scomp_LempelZiv test: ----------------------------------------------- N = 10, n = 134217728, r = 15, s = 15, k = 27 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.20 p-value of test : 0.40 Kolmogorov-Smirnov- statistic = D- : 0.015 p-value of test : 0.98 Anderson-Darling statistic = A2 : 0.73 p-value of test : 0.53 Tests on the sum of all N observations Standardized normal statistic : -1.20 p-value of test : 0.88 Sample variance : 0.89 p-value of test : 0.53 ----------------------------------------------- CPU time used : 00:00:55.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sspectral_Fourier3 test: ----------------------------------------------- N = 100000, n = 16384, r = 0, s = 3, k = 14 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.021 p-value of test : 0.02 Kolmogorov-Smirnov- statistic = D- : 9.76e-3 p-value of test : 0.46 Anderson-Darling statistic = A2 : 2.29 p-value of test : 0.06 ----------------------------------------------- CPU time used : 00:00:39.04 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sspectral_Fourier3 test: ----------------------------------------------- N = 100000, n = 16384, r = 27, s = 3, k = 14 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.016 p-value of test : 0.11 Kolmogorov-Smirnov- statistic = D- : 4.76e-3 p-value of test : 0.83 Anderson-Darling statistic = A2 : 1.57 p-value of test : 0.16 ----------------------------------------------- CPU time used : 00:00:39.54 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_LongestHeadRun test: ----------------------------------------------- N = 1, n = 1000, r = 0, s = 3, L = 10000020 ----------------------------------------------- Number of degrees of freedom : 8 Chi-square statistic : 9.12 p-value of test : 0.33 ----------------------------------------------- Global longest run of 1 : 35.00 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:01:47.05 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_LongestHeadRun test: ----------------------------------------------- N = 1, n = 1000, r = 27, s = 3, L = 10000020 ----------------------------------------------- Number of degrees of freedom : 8 Chi-square statistic : 4.78 p-value of test : 0.78 ----------------------------------------------- Global longest run of 1 : 35.00 p-value of test : 0.14 ----------------------------------------------- CPU time used : 00:01:50.10 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_PeriodsInStrings test: ----------------------------------------------- N = 10, n = 500000000, r = 0, s = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.30 p-value of test : 0.13 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.68 Anderson-Darling statistic = A2 : 0.84 p-value of test : 0.45 Test on the sum of all N observations Number of degrees of freedom : 200 Chi-square statistic : 183.59 p-value of test : 0.79 ----------------------------------------------- CPU time used : 00:02:51.45 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_PeriodsInStrings test: ----------------------------------------------- N = 10, n = 500000000, r = 20, s = 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.25 p-value of test : 0.25 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.51 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 Test on the sum of all N observations Number of degrees of freedom : 200 Chi-square statistic : 195.89 p-value of test : 0.57 ----------------------------------------------- CPU time used : 00:02:56.45 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingWeight2 test: ----------------------------------------------- N = 10, n = 1000000000, r = 0, s = 3, L = 1000000 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.15 p-value of test : 0.57 Kolmogorov-Smirnov- statistic = D- : 0.19 p-value of test : 0.43 Anderson-Darling statistic = A2 : 1.02 p-value of test : 0.34 Test on the sum of all N observations Number of degrees of freedom : 10000 Chi-square statistic :10157.86 p-value of test : 0.13 ----------------------------------------------- CPU time used : 00:00:57.75 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingWeight2 test: ----------------------------------------------- N = 10, n = 1000000000, r = 27, s = 3, L = 1000000 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.18 p-value of test : 0.48 Kolmogorov-Smirnov- statistic = D- : 0.38 p-value of test : 0.04 Anderson-Darling statistic = A2 : 1.47 p-value of test : 0.18 Test on the sum of all N observations Number of degrees of freedom : 10000 Chi-square statistic :10121.19 p-value of test : 0.20 ----------------------------------------------- CPU time used : 00:01:01.20 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 1000000000, r = 10, s = 10, L = 30 ----------------------------------------------- Normal statistic : 1.36 p-value of test : 0.09 ----------------------------------------------- CPU time used : 00:01:13.01 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 100000000, r = 10, s = 10, L = 300 ----------------------------------------------- Normal statistic : 0.36 p-value of test : 0.36 ----------------------------------------------- CPU time used : 00:01:09.29 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingCorr test: ----------------------------------------------- N = 1, n = 100000000, r = 10, s = 10, L = 1200 ----------------------------------------------- Normal statistic : -0.12 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:04:34.86 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 10, n = 30000000, r = 0, s = 3, L = 30, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.24 p-value of test : 0.28 Kolmogorov-Smirnov- statistic = D- : 0.13 p-value of test : 0.65 Anderson-Darling statistic = A2 : 0.74 p-value of test : 0.53 Test on the sum of all N observations Number of degrees of freedom : 4890 Chi-square statistic : 4850.28 p-value of test : 0.65 ----------------------------------------------- CPU time used : 00:01:53.80 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 10, n = 30000000, r = 27, s = 3, L = 30, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.25 p-value of test : 0.24 Kolmogorov-Smirnov- statistic = D- : 0.11 p-value of test : 0.74 Anderson-Darling statistic = A2 : 0.66 p-value of test : 0.59 Test on the sum of all N observations Number of degrees of freedom : 4890 Chi-square statistic : 4816.01 p-value of test : 0.77 ----------------------------------------------- CPU time used : 00:01:59.57 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 30000000, r = 0, s = 4, L = 300, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 4117 Chi-square statistic : 4183.44 p-value of test : 0.23 ----------------------------------------------- CPU time used : 00:01:25.02 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 30000000, r = 26, s = 4, L = 300, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 4117 Chi-square statistic : 4147.28 p-value of test : 0.37 ----------------------------------------------- CPU time used : 00:01:29.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 10000000, r = 0, s = 5, L = 1200, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 11825 Chi-square statistic :11803.57 p-value of test : 0.55 ----------------------------------------------- CPU time used : 00:01:33.79 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_HammingIndep test: ----------------------------------------------- N = 1, n = 10000000, r = 25, s = 5, L = 1200, d = 0 Counters with expected numbers >= 10 ----------------------------------------------- Number of degrees of freedom : 11825 Chi-square statistic :11791.39 p-value of test : 0.58 ----------------------------------------------- CPU time used : 00:01:38.25 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_Run test: ----------------------------------------------- N = 1, n = 2000000000, r = 0, s = 3 ----------------------------------------------- Total number of 1 runs: 2000000000 Number of degrees of freedom : 54 Chi2 statistic for number of runs : 62.56 p-value of test : 0.20 ----------------------------------------------- Total number of bits: 7999957470 Normal statistic for number of bits : -0.34 p-value of test : 0.63 ----------------------------------------------- CPU time used : 00:01:16.00 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_Run test: ----------------------------------------------- N = 1, n = 2000000000, r = 27, s = 3 ----------------------------------------------- Total number of 1 runs: 2000000000 Number of degrees of freedom : 54 Chi2 statistic for number of runs : 65.11 p-value of test : 0.14 ----------------------------------------------- Total number of bits: 7999956321 Normal statistic for number of bits : -0.35 p-value of test : 0.64 ----------------------------------------------- CPU time used : 00:01:18.57 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000030, r = 0, s = 3, d = 1 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.28 p-value of test : 0.18 Kolmogorov-Smirnov- statistic = D- : 0.10 p-value of test : 0.76 Anderson-Darling statistic = A2 : 0.50 p-value of test : 0.74 Tests on the sum of all N observations Standardized normal statistic : -0.51 p-value of test : 0.69 Sample variance : 0.71 p-value of test : 0.70 ----------------------------------------------- CPU time used : 00:02:49.27 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000029, r = 0, s = 3, d = 3 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.13 p-value of test : 0.66 Kolmogorov-Smirnov- statistic = D- : 0.17 p-value of test : 0.51 Anderson-Darling statistic = A2 : 0.30 p-value of test : 0.94 Tests on the sum of all N observations Standardized normal statistic : 0.069 p-value of test : 0.47 Sample variance : 0.68 p-value of test : 0.73 ----------------------------------------------- CPU time used : 00:02:30.81 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000030, r = 27, s = 3, d = 1 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.095 p-value of test : 0.78 Kolmogorov-Smirnov- statistic = D- : 0.30 p-value of test : 0.14 Anderson-Darling statistic = A2 : 1.01 p-value of test : 0.35 Tests on the sum of all N observations Standardized normal statistic : 0.45 p-value of test : 0.33 Sample variance : 1.52 p-value of test : 0.13 ----------------------------------------------- CPU time used : 00:02:51.88 Generator state: *********************************************************** HOST = Thijss-iMac.local, Darwin sitmo sstring_AutoCor test: ----------------------------------------------- N = 10, n = 1000000029, r = 27, s = 3, d = 3 ----------------------------------------------- Kolmogorov-Smirnov+ statistic = D+ : 0.079 p-value of test : 0.84 Kolmogorov-Smirnov- statistic = D- : 0.18 p-value of test : 0.48 Anderson-Darling statistic = A2 : 0.59 p-value of test : 0.65 Tests on the sum of all N observations Standardized normal statistic : 0.78 p-value of test : 0.22 Sample variance : 1.85 p-value of test : 0.05 ----------------------------------------------- CPU time used : 00:02:32.94 Generator state: ========= Summary results of BigCrush ========= Version: TestU01 1.2.3 Generator: sitmo Number of statistics: 160 Total CPU time: 03:44:06.82 All tests were passed ```sitmo/vignettes/uniform_rng_with_sitmo.Rmd0000644000176200001440000001352213314572527020670 0ustar liggesusers--- title: "Making a Uniform PRNG with `sitmo`" author: "James Balamuta" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Making a Uniform PRNG with `sitmo`} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Intro Many of the random number generators for various distributions rely on the Probability Integral Transformation theorem. Succintly stated as: **Theorem** Let $X$ be a random variable that has a cumulative distribution function (CDF) of $F_X\left({x}\right)$. Then, define random variable $U = F_X\left({X}\right)$. Thus, $U$ is a uniform distribution. **Proof** Given any random variable **X**, define $U = F_X\left({X}\right)$. Then: $$\begin{align*} F_U\left({u}\right) &= P\left( {U \le u} \right) \\ &= P\left( {{F_X}\left( X \right) \le u} \right) \\ &= P\left( {X \le F_X^{ - 1}\left( u \right)} \right) \\ &= {F_X}\left( {F_X^{ - 1}\left( u \right)} \right) \\ &= u \\ \end{align*}$$ Therefore, $F_U\left({u}\right)$ is the CDF of a Uniform(0,1) RV. Hence, $U$ has a uniform distribution on $[0,1]$. # Random Uniform Distribution (runif) in C++ Within the R/C++ API, there are three ways one can use a random uniform distribution. - Through the use of `Rcpp`'s hook into the `Rmath.h` library that controls random generation via `R::runif(a,b)` or Rcpp's sugar `Rcpp::runif(n,a,b)`. - By using C++11's [built-in generators and statistical distributions](http://en.cppreference.com/w/cpp/numeric/random) to create a uniform real random variable generator. ```{r cppN, eval = F, engine='Rcpp'} #include #include // [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] void test(unsigned int n, double a, double b) { // Random Seed std::random_device rd; // Random engine std::mt19937 mt(rd()); // Uniform Distribution std::uniform_real_distribution dist(a, b); // Generate n realizations for (unsigned int i=0; i #include // [[Rcpp::depends(sitmo)]] //' Random Uniform Number Generator with sitmo //' //' The function provides an implementation of sampling from a random uniform distribution //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param seed A special \code{unsigned integer} containing a single seed. //' @return A \code{vec} containing the realizations. //' @export //' @examples //' a = runif_sitmo(10) // [[Rcpp::export]] Rcpp::NumericVector runif_sitmo(unsigned int n, double min = 0.0, double max = 1.0, uint32_t seed = 1) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng(seed); // Obtain the range between max and min double dis = max - min; for(unsigned int i = 0; i < n; ++i) { // Sample from the RNG and divide it by the maximum value possible // (c.f. SITMO_RAND_MAX, which is 4294967295) // Apply appropriate scale dis = (MAX-MIN) and add min starting loc o[i] = min + ((double) eng() / (sitmo::prng::max())) * (dis); } return o; } ``` To verify the quality of sitmo in an informal way, we can test the dependency or correlation between the seeds. To do so, we generate the same number of realizations under different seeds that have a range. With this being said, we consider the following code: ```{r correlation} # Load packages library(ggplot2) library(sitmo) # Number of Observations to Generate n = 1e6 # Number of seeds to try (1 ... S) nseeds = 30 # Storage for seed number and the correlation of the realizations between generators. cppdf = data.frame(s1 = numeric(nseeds), s2 = numeric(nseeds), cor = numeric(nseeds), stringsAsFactors = F) # Generate observations under the seeds count = 0 for(i in seq_len(nseeds)){ for(j in i:nseeds){ u1 = runif_sitmo(n, 0.0, 1.0, i) u2 = runif_sitmo(n, 0.0, 1.0, j) count = count + 1 cppdf[count,] = c(i, j, cor(u1,u2)) } } ``` We can visualize the data by using a correlation graph. In this case, the generations off the diagonal should have no correlation ($r = 0$) whereas the seeds on the diagonal should have a correlation of 1 ($r = 1$). ```{r corr_plot, fig.width = 7, fig.height = 4} # Create Correlation Plot ggplot(cppdf) + geom_tile(aes(x = s1, y = s2, fill = cor)) + xlab("Seed 1") + ylab("Seed 2") + ggtitle("Correlations between seed realizations using `sitmo`") + theme_bw() ``` Observing the correlation graph, we note that the pattern predicted - only correlation on the diagonal - exists. Thus, the generation under these seeds are ideal. sitmo/vignettes/sitmo_internals.Rmd0000644000176200001440000004005613314572527017311 0ustar liggesusers--- title: "Deployment of `sitmo` within C++ Code" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Deployment of `sitmo` within C++ Code} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- Within this vignette, details on how to use [sitmo](https://github.com/stdfin/random/)'s header will be detailed. First, the background on `sitmo` will be provided. Secondly, function calls will be shown alongside of a description. Thirdly, examples will be provided of how one can use the `sitmo` header. # What is `sitmo` and can I eat it? `sitmo` is the consultancy agency founded by Thijs van den Berg. They first released a Parallel Psuedo Random Number Generator (PPRNG) under the same name using work in Salmon, K., et al.'s "Parallel Random Numbers: As Easy as 1, 2, 3" in the conference proceedings of the 2011 International Conference for High Performance Computing, Networking, Storage and Analysis. Support for `sitmo` exists for both C++ standards: C++98 and C++11. Furthermore, there are many different PPRNGs that are available: [trng](https://www.numbercrunch.de/trng/), [SPRNG](http://www.sprng.org/), [RngStreams](http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html), [OMPRNG](http://homepage.stat.uiowa.edu/~mbognar/omprng/). However, none are as appealing in my eyes than [sitmo](https://github.com/stdfin/random/), which provides a straight forward interface to generating psuedo-random numbers (RNG), the least restrictive license (MIT), and speed. Over the span of the last few years, the `sitmo` agency has released two other engines of interest for C++11: `threefry` and `vandercorput`. The `threefry` engine is a rewritten PPRNG version of `sitmo` for C++11 whereas the `vandercorput` engine provides one dimensional low-discrepancy sequencing. The latter engines are also available under the MIT license. # Accessing and using engines in `sitmo` The header files for `sitmo`, `threefry`, and `vandercorput` engines are contained within this package. To use one of these engine header files within your own package, you can link to the `sitmo` package within your description file. e.g. LinkingTo: Rcpp, sitmo Imports: Rcpp (>= 0.12.11) To use C++11's statistical distributions, you **may** want to add the following to your `src/Makevars` and `src/Makevars.win` file: CXX_STD = CXX11 Within a `C++` file in `src/`, then add: ```{Rcpp, eval = FALSE} #include #include // SITMO for C++98 & C++11 PPRNG #include // THREEFRY C++11-only PPRNG #include // VANDERCORPUT C++11-only Low-discrepancy sequence ``` You do _not_ need to add each header file. Pick and choose the appropriate engine for your needs. Or you can do a direct embed in your application. I would advise for the prior though and, hence, the reason for this package. Below is a breakdown of functions that are available for the engines. Please note, that the engine predominantly highlight is the original: `sitmo::prng`. ## Construct an engine | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | prng() | Creates an engine with a default initial state. | | prng(prng& x) | Creates an engine with the same initial state as the engine x. | | prng(uint32_t s) | Creates an engine with initial state determined by s. Engines created with different initial states have the guarantee to generate independent non-overlapping random sequences of length $2^128$. | | prng(SeedSeq q) | Creates an engine with an initial state that depends on a sequence produced by one call to q.generate. | ## Seed modifiers To use the seed modifiers, one must first construct an engine using a method detailed in the previous table. ```{Rcpp, eval = FALSE} // Generate engine called eng_org. sitmo::prng eng_org; // Generate engine called eng_org. sitmo::threefry eng_tf; // Generate engine called eng_vc. sitmo::vandercorput eng_vc; ``` From there, the engine state can be modified using: | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | e.seed() | Returns the random engine to the default state. The same prng(). | | e.seed(uint32_t s) | Set the engine to a state determined by s. Same as prng(uint32_t s) | | e.seed(SeedSeq q) | Set the engine to a state that depends on a sequence produced by one call to q.generate. Same as prng(SeedSeq q) | | e() | Advances the internal state and returns a 32 bit random number. | | e.discard(uint64_t n) | Advances the internal state with n steps in constant time. | ## Misc Seed Using the same engine created above, one can access additional state information using the following: | Expression | Description |:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | e1 == e2 | Test for equivalence of two prng’s. Two engines are the same if they generate the exact same random sequence. | | e1 != e2 | Test for non-equivalence of two prng’s. Two engines are different if they generate different random sequences. | | e.version() | The current version of the engine, returns the value 2 | ## Examples The examples displayed in the vignette are taken directly from the project's `src` directory that is found here [https://github.com/coatless/sitmo](https://github.com/coatless/sitmo). Additional commentary is added. ### Hello World Example Below is the most rudimentary example using `sitmo`. It describes the process of creating a `sitmo` engine and obtaining a draw. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example RNG Draws with sitmo //' //' Shows a basic setup and use case for sitmo. //' //' @param n A \code{unsigned int} is a . //' @return A \code{vec} with random sequences. //' @examples //' n = 10 //' sitmo_draws(n) // [[Rcpp::export]] Rcpp::NumericVector sitmo_draws(unsigned int n) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng; // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i) = eng(); } return o; } ``` ### Setting a Seed Here the ability for a seed to be set is used. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{vector} with random sequences. //' @examples //' n = 10 //' a = sitmo_engine_seed(n, 1337) //' b = sitmo_engine_seed(n, 1337) //' c = sitmo_engine_seed(n, 1338) //' //' isTRUE(all.equal(a,b)) //' isTRUE(all.equal(a,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_engine_seed(unsigned int n, unsigned int seed) { // Create Rcpp Matrix Rcpp::NumericVector o(n); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n; ++i){ o(i) = eng(); } return o; } ``` ### Reset RNG engine The code used here can be found to work when the initial state of the engine needs to be reverted. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Example Seed Set and RNG Draws with sitmo //' //' Shows how to set a seed in sitmo. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seed An \code{unsigned int} that controls the rng seed. //' @return A \code{matrix} with random sequences. //' @examples //' n = 10 //' a = sitmo_engine_seed(n, 1337) //' //' isTRUE(all.equal(a[,1],a[,2])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_engine_reset(unsigned int n, unsigned int seed) { // Create Rcpp Vector Rcpp::NumericMatrix o(n,2); // Create a prng engine with a specific seed sitmo::prng eng(static_cast(seed)); // Draw from base engine for (unsigned int i=0; i < n ; ++i){ o(i,0) = eng(); } // Reset seed eng.seed(); // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i,1) = eng(); } return o; } ``` ### Two RNG Streams This example displays the ability of `sitmo` to handle parallel streams of rng when a predefined number of streams is known. ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Two RNG engines running side-by-side //' //' Shows how to create two separate RNGs and increase them together. //' //' @param n An \code{unsigned int} that dictates how many realizations occur. //' @param seeds A \code{vec} containing two integers greater than 0. //' @return A \code{matrix} with random sequences. //' @examples //' n = 10 //' a = sitmo_two_seeds(n, c(1337,1338)) //' //' b = sitmo_two_seeds(n, c(1337,1337)) //' //' isTRUE(all.equal(a[,1],a[,2])) //' //' isTRUE(all.equal(b[,1],b[,2])) //' //' isTRUE(all.equal(a[,1],b[,1])) // [[Rcpp::export]] Rcpp::NumericMatrix sitmo_two_seeds(unsigned int n, Rcpp::NumericVector seeds) { if(seeds.size() != 2) Rcpp::stop("Need exactly two seeds for this example."); // Create Rcpp Matrix Rcpp::NumericMatrix o(n,2); // Create a prng engine with a specific seed sitmo::prng eng1; eng1.seed(seeds(0)); sitmo::prng eng2; eng2.seed(seeds(1)); // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i,0) = eng1(); o(i,1) = eng2(); } return o; } ``` ### Uniform Random Number Generator Under C++98, one does not have access to the C++11 implementation of the Uniform distribution. This is particularly problematic as a lot of the distribution RNG rely upon being able to sample from $\left[0,1\right]$ ala the Probability Integral Transformation Theorem. Additional details are discussed in a separate vignette ("Making a Uniform PRNG with sitmo"). ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] //' Random Uniform Number Generator with sitmo //' //' The function provides an implementation of sampling from a random uniform distribution //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param min A \code{double} indicating the minimum \eqn{a} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param max A \code{double} indicating the maximum \eqn{b} value //' in the uniform's interval \eqn{\left[a,b\right]} //' @param seed A special \code{unsigned integer} containing a single seed. //' @return A \code{vec} containing the realizations. //' @export //' @examples //' a = runif_sitmo(10) // [[Rcpp::export]] Rcpp::NumericVector runif_sitmo(unsigned int n, double min = 0.0, double max = 1.0, uint32_t seed = 1) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng(seed); // Obtain the range between max and min double dis = max - min; for(int i = 0; i < n; ++i) { // Sample from the RNG and divide it by the maximum value possible (can also use SITMO_RAND_MAX, which is 4294967295) // Apply appropriate scale (MAX-MIN) o[i] = min + ((double) eng() / (sitmo::prng::max())) * (dis); } return o; } ``` ### OpenMP Example One of the primary reasons why `sitmo` is desirable is because it can be used under parallelization via OpenMP and MPI. Below is an example where it is used in a parallel setting to generate numbers. Note, to ensure that code works cross-platform, please protect against OpenMP includes as the package will otherwise fail on OS X. To protect against a lack of OpenMP headers use: ```{Rcpp, eval = FALSE} #ifdef _OPENMP #include #endif ``` When writing sections of parallelized code, also protect that code using: ```{Rcpp, eval = FALSE} #ifdef _OPENMP // multithreaded OpenMP version of code #else // single-threaded version of code #endif ``` Furthermore, add the following to your `Makevars` and `Makevars.win`: ```{r engine='asis', eval = F} PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS) PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS) ``` With this being said, let's take a look at an example parallelization using `sitmo`: ```{Rcpp, eval = FALSE} #include #include // SITMO PPRNG // [[Rcpp::depends(sitmo)]] #ifdef _OPENMP #include #endif // [[Rcpp::plugins(openmp)]] //' Test Generation using sitmo and C++11 //' //' The function provides an implementation of creating realizations from the default engine. //' //' @param n An \code{unsigned integer} denoting the number of realizations to generate. //' @param seeds A \code{vec} containing a list of seeds. Each seed is run on its own core. //' @return A \code{vec} containing the realizations. //' @details //' The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux). //' However, it does provide a very good example as to how to make ones code applicable across multiple platforms. //' //' With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied. //' In the event that one is using OS X, only the first seed supplied is used. //' //' @export //' @examples //' a = sitmo_parallel(10, 5.0, c(1)) //' //' b = sitmo_parallel(10, 5.0, c(1)) //' //' c = sitmo_parallel(10, 5.0, c(2)) //' //' isTRUE(all.equal(a,b)) //' //' isTRUE(all.equal(a,c)) // [[Rcpp::export]] Rcpp::NumericVector sitmo_parallel(unsigned int n, Rcpp::NumericVector& seeds){ unsigned int ncores = seeds.size(); Rcpp::NumericVector q(n); #ifdef _OPENMP #pragma omp parallel num_threads(ncores) if(ncores > 1) { #endif // Engine requires uint32_t inplace of unsigned int uint32_t active_seed; // Write the active seed per core or just write one of the seeds. #ifdef _OPENMP active_seed = static_cast(seeds[omp_get_thread_num()]); #else active_seed = static_cast(seeds[0]); #endif sitmo::prng eng( active_seed ); // Parallelize the Loop #ifdef _OPENMP #pragma omp for schedule(static) #endif for (unsigned int i = 0; i < n; i++){ q[i] = eng(). } #ifdef _OPENMP } #endif return q; } ``` sitmo/README.md0000644000176200001440000001257313314573667012713 0ustar liggesusers [![Travis-CI Build Status](https://travis-ci.org/coatless/sitmo.svg?branch=master)](https://travis-ci.org/coatless/sitmo)[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/sitmo)](http://www.r-pkg.org/pkg/sitmo) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/sitmo)](https://cran.r-project.org/package=sitmo) `sitmo`: A header-only package for *R* containing SITMO PPRNGs ============================================================== The repository houses the `sitmo` R package for Parallel Psuedo Random Number Generation (PPRNG). The package provides a way to obtain the SITMO Consulting’s PPRNG header files via **LinkTo**. Installing `sitmo` ------------------ `sitmo` is available on both CRAN (Stable) and GitHub (Development). Using CRAN to download and install `sitmo` is the preferred option as it is significantly more stable vs. the GitHub version. ### Stable (CRAN) Install Instructions To install the package from CRAN, you can simply type: ``` r install.packages("sitmo") ``` The package will be installed and available in a similar fashion to other R packages. The main exception to this note is that to use `sitmo` to create a package you will need to acquire a compiler. This is detailed under the development install instructions. ### Development Install Instructions To install the package, you must first have a compiler on your system that is compatible with R. For help on obtaining a compiler consult: - [macOS](http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-os-x/) - [Windows](http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/) With a compiler in hand, one can then install the package from GitHub by: ``` r install.packages("devtools") devtools::install_github("coatless/sitmo") ``` Using `sitmo` ------------- There are two ways to use `sitmo`. The first is to use `sitmo` in a standalone script. The script is typically built using `sourceCpp()`. The second approach allows for `sitmo` to be used within an R package. ### Standalone file usage Within the `C++` file, the `sitmo` package provides an Rcpp plugins’ depends statement that must be included after `sitmo.h` header. This plugin statement indicates that a dependency is `sitmo`. ``` cpp #include #include // [[Rcpp::depends(sitmo)]] ``` To use the two other engines, `threefry` and `vandercorput`, they must be loaded like: ``` cpp #include #include // or use #include // [[Rcpp::depends(sitmo)]] // [[Rcpp::plugins(cpp11)]] ``` #### `sitmo` Engine Example Below is a hello world example meant to show a basic implementation of `sitmo`. ``` cpp #include #include // C++11 RNG library #include // SITMO PPRNG // Rcpp depends attribute is required for standalone use. // It is not needed if in package linking to the sitmo package (detailed next). // [[Rcpp::depends(sitmo)]] // [[Rcpp::export]] Rcpp::NumericVector sitmo_draws_ex(unsigned int n) { Rcpp::NumericVector o(n); // Create a prng engine sitmo::prng eng; // Draw from base engine for (unsigned int i=0; i< n ; ++i){ o(i) = eng(); } return o; } /*** R sitmo_draws_ex(5) */ ``` #### `threefry` Engine Example Below is a hello world example meant to show a basic implementation of `threefry`. This engine *requires* C++11. ``` cpp #include #include // Rcpp depends attribute is required for standalone use. // It is not needed if in package linking to the sitmo package (detailed next). // [[Rcpp::depends(sitmo)]] // threefry requires access to a C++11 compatible compiler // [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] void threefry_draws_streaming(unsigned int n) { sitmo::threefry eng1, eng2; eng1.seed(0); // reset the first engine (not really necessary) eng2.seed(1); // 2nd engine gets a different seed Rcpp::Rcout << "\nTwo independent streams.\n"; for (unsigned int i = 0; i < n; ++i) Rcpp::Rcout << eng1() << " " << eng2() << "\n"; } ``` #### `vandercorput` Engine Example Below is a hello world example meant to show a basic implementation of `vandercorput`. This engine *requires* C++11. ``` cpp #include #include // Rcpp depends attribute is required for standalone use. // It is not needed if in package linking to the sitmo package (detailed next). // [[Rcpp::depends(sitmo)]] // vandercorput requires access to a C++11 compatible compiler // [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] void vandercorput_draws_streaming(unsigned int n) { sitmo::vandercorput eng; for (unsigned int i = 0; i < n; ++i) Rcpp::Rcout << eng() << "\n"; } ``` ### Package usage To use `sitmo` in your R package, modify the `DESCRIPTION` file by adding: LinkingTo: Rcpp, sitmo Imports: Rcpp (>= 0.12.11) To use C++11’s statistical distributions, you **may** want to add the following to your `src/Makevars` and `src/Makevars.win` file: CXX_STD = CXX11 Within a `C++` file in `src/`, then add: ``` cpp #include #include // SITMO for C++98 & C++11 PPRNG #include // THREEFRY C++11-only PPRNG #include // VANDERCORPUT C++11-only Low-discrepancy sequence ``` You do *not* need to add each header file. Pick and choose the appropriate engine for your needs. sitmo/MD50000644000176200001440000000404613414743467011736 0ustar liggesuserscbf628d750e403f51b014312358e12ed *DESCRIPTION 4030af1c1bbf48c6194b495fe984ff0e *LICENSE 59c5bd9d141d69a11b410469c881e62f *NAMESPACE 34529772a3ddf9bb0782909f86c74050 *NEWS.md 1287c4b67d627b69c65e1bcc75629aef *R/RcppExports.R 12ea1a40d72594c20cc07a858fee06e6 *R/sitmo-package.r 8f44b1f9a57af6736a648f4b174e94c7 *README.md 31f6d3eabc49f822130b67ca4286233f *build/vignette.rds f8e792be6b5f7a93af3cd49b7a1ceb73 *inst/doc/big_crush_test.R d941b3e807d710c5b6e88b01f448ce64 *inst/doc/big_crush_test.Rmd a52109ecc09b9a5bf5329c4de7a15409 *inst/doc/big_crush_test.html 7ac99f81a66cb20aa55ea09d13245d69 *inst/doc/sitmo_internals.R e726aa6552ce720cd3082977712d3543 *inst/doc/sitmo_internals.Rmd 971e27ad1148c9462b27021a194e52d6 *inst/doc/sitmo_internals.html a5e619c9343cfbc56063fb8f37e173af *inst/doc/uniform_rng_with_sitmo.R 25a64701c21f1ff07d2cdee50ccc429f *inst/doc/uniform_rng_with_sitmo.Rmd ee8e7b20a1f123dc1b0c9e608deae5eb *inst/doc/uniform_rng_with_sitmo.html 54dff23a8cb09d6109523bf625f39a09 *inst/include/sitmo.h 3eb47f951014983432a7e0800e664940 *inst/include/threefry.h 2c057007bd5a1dbbc2e122661b243492 *inst/include/vandercorput.h 4b245269c3c8d9323f70940a31422aa8 *man/runif_r.Rd bbbd15c6ba591067306670eb66d02ecd *man/runif_sitmo.Rd 5fb212b5771b2e970d93e3fa0d18d9d6 *man/sitmo-package.Rd cfa8184b18f34e50d92b028bd2e0145f *man/sitmo_draws.Rd 0f6205e041056d5b64ebb0dfb3d73795 *man/sitmo_engine_reset.Rd 4f8c15ced694f8c3e4979bd32685c0bb *man/sitmo_engine_seed.Rd 5c8e46c237077f069b044e50bc2df4eb *man/sitmo_parallel.Rd d2fa6ce808abd98b68eec9fcfb16922b *man/sitmo_two_seeds.Rd a568f9c67af31adcfb51c881c0595b02 *src/Makevars 81e20e4f433444dd1dc3eb6cfda3b7f3 *src/Makevars.win d8b790700f5ed24d157e0348ee1c910d *src/RcppExports.cpp 7d3b55c604e63ba78d62b81ae9d0e75c *src/sitmo_demo.cpp ccc7ebdd978ef9fb11a77f399b39c8db *src/sitmo_parallel.cpp 2f2e72d92b9c20fa96e35840a3b60113 *src/sitmo_runif.cpp d941b3e807d710c5b6e88b01f448ce64 *vignettes/big_crush_test.Rmd e726aa6552ce720cd3082977712d3543 *vignettes/sitmo_internals.Rmd 25a64701c21f1ff07d2cdee50ccc429f *vignettes/uniform_rng_with_sitmo.Rmd sitmo/build/0000755000176200001440000000000013413722047012507 5ustar liggesuserssitmo/build/vignette.rds0000644000176200001440000000051113413722047015043 0ustar liggesusersR]K01@/AvQFQkD7δKdzsrϹ7}p\u4 Hg$O֢ETa\ $Q%OSX0D4ɸ(&HZn薟Zdu#-ɣFXVTIøw7%f >l F<ņ|!;p?޵d{g WvyÖU'hOm ?00:>C%CoADO. XGm0KSMͅλB#Њ4?݇hM8E u ositmo/DESCRIPTION0000644000176200001440000000347513414743467013141 0ustar liggesusersPackage: sitmo Title: Parallel Pseudo Random Number Generator (PPRNG) 'sitmo' Header Files Version: 2.0.1 Authors@R: c(person("James", "Balamuta", email = "balamut2@illinois.edu", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-2826-8458")), person("Thijs","van den Berg", email = "thijs@sitmo.com", role = c("aut", "cph")), person("Ralf", "Stubner", email = "ralf.stubner@daqana.com", role = c("ctb"))) Description: Provided within are two high quality and fast PPRNGs that may be used in an 'OpenMP' parallel environment. In addition, there is a generator for one dimensional low-discrepancy sequence. The objective of this library to consolidate the distribution of the 'sitmo' (C++98 & C++11), 'threefry' and 'vandercorput' (C++11-only) engines on CRAN by enabling others to link to the header files inside of 'sitmo' instead of including a copy of each engine within their individual package. Lastly, the package contains example implementations using the 'sitmo' package and three accompanying vignette that provide additional information. Depends: R (>= 3.2.0) URL: https://github.com/coatless/sitmo, http://thecoatlessprofessor.com/projects/sitmo/, https://github.com/stdfin/random/ BugReports: https://github.com/coatless/sitmo/issues License: MIT + file LICENSE LazyData: true LinkingTo: Rcpp Imports: Rcpp (>= 0.12.13) RoxygenNote: 6.1.1 Suggests: knitr, rmarkdown, ggplot2 VignetteBuilder: knitr Encoding: UTF-8 NeedsCompilation: yes Packaged: 2019-01-04 18:21:27 UTC; ronin Author: James Balamuta [aut, cre, cph] (), Thijs van den Berg [aut, cph], Ralf Stubner [ctb] Maintainer: James Balamuta Repository: CRAN Date/Publication: 2019-01-07 21:40:07 UTC sitmo/man/0000755000176200001440000000000013321155361012160 5ustar liggesuserssitmo/man/sitmo_draws.Rd0000644000176200001440000000060713204107660015004 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{sitmo_draws} \alias{sitmo_draws} \title{Example RNG Draws with sitmo} \usage{ sitmo_draws(n) } \arguments{ \item{n}{A \code{unsigned int} is a .} } \value{ A \code{vec} with random sequences. } \description{ Shows a basic setup and use case for sitmo. } \examples{ n = 10 a = sitmo_draws(n) } sitmo/man/runif_sitmo.Rd0000644000176200001440000000151113204107660015002 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{runif_sitmo} \alias{runif_sitmo} \title{Random Uniform Number Generator with sitmo} \usage{ runif_sitmo(n, min = 0, max = 1, seed = 1L) } \arguments{ \item{n}{An \code{unsigned integer} denoting the number of realizations to generate.} \item{min}{A \code{double} indicating the minimum \eqn{a} value in the uniform's interval \eqn{\left[a,b\right]}} \item{max}{A \code{double} indicating the maximum \eqn{b} value in the uniform's interval \eqn{\left[a,b\right]}} \item{seed}{A special \code{unsigned integer} containing a single seed.} } \value{ A \code{numeric vector} containing the realizations. } \description{ The function provides an implementation of sampling from a random uniform distribution } \examples{ a = runif_sitmo(10) } sitmo/man/sitmo-package.Rd0000644000176200001440000000274413413717062015206 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sitmo-package.r \docType{package} \name{sitmo-package} \alias{sitmo} \alias{sitmo-package} \title{sitmo: Parallel Pseudo Random Number Generator (PPRNG) 'sitmo' Header Files} \description{ Provided within are two high quality and fast PPRNGs that may be used in an 'OpenMP' parallel environment. In addition, there is a generator for one dimensional low-discrepancy sequence. The objective of this library to consolidate the distribution of the 'sitmo' (C++98 & C++11), 'threefry' and 'vandercorput' (C++11-only) engines on CRAN by enabling others to link to the header files inside of 'sitmo' instead of including a copy of each engine within their individual package. Lastly, the package contains example implementations using the 'sitmo' package and three accompanying vignette that provide additional information. } \seealso{ Useful links: \itemize{ \item \url{https://github.com/coatless/sitmo} \item \url{http://thecoatlessprofessor.com/projects/sitmo/} \item \url{https://github.com/stdfin/random/} \item Report bugs at \url{https://github.com/coatless/sitmo/issues} } } \author{ \strong{Maintainer}: James Balamuta \email{balamut2@illinois.edu} (0000-0003-2826-8458) [copyright holder] Authors: \itemize{ \item Thijs van den Berg \email{thijs@sitmo.com} [copyright holder] } Other contributors: \itemize{ \item Ralf Stubner \email{ralf.stubner@daqana.com} [contributor] } } sitmo/man/sitmo_engine_reset.Rd0000644000176200001440000000107313204107660016331 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{sitmo_engine_reset} \alias{sitmo_engine_reset} \title{Example Seed Set and RNG Draws with sitmo} \usage{ sitmo_engine_reset(n, seed) } \arguments{ \item{n}{An \code{unsigned int} that dictates how many realizations occur.} \item{seed}{An \code{unsigned int} that controls the rng seed.} } \value{ A \code{matrix} with random sequences. } \description{ Shows how to set a seed in sitmo. } \examples{ n = 10 a = sitmo_engine_reset(n, 1337) isTRUE(all.equal(a[,1],a[,2])) } sitmo/man/sitmo_engine_seed.Rd0000644000176200001440000000120413204107660016123 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{sitmo_engine_seed} \alias{sitmo_engine_seed} \title{Example Seed Set and RNG Draws with sitmo} \usage{ sitmo_engine_seed(n, seed) } \arguments{ \item{n}{An \code{unsigned int} that dictates how many realizations occur.} \item{seed}{An \code{unsigned int} that controls the rng seed.} } \value{ A \code{vector} with random sequences. } \description{ Shows how to set a seed in sitmo. } \examples{ n = 10 a = sitmo_engine_seed(n, 1337) b = sitmo_engine_seed(n, 1337) c = sitmo_engine_seed(n, 1338) isTRUE(all.equal(a,b)) isTRUE(all.equal(a,c)) } sitmo/man/sitmo_two_seeds.Rd0000644000176200001440000000130113204107660015650 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{sitmo_two_seeds} \alias{sitmo_two_seeds} \title{Two RNG engines running side-by-side} \usage{ sitmo_two_seeds(n, seeds) } \arguments{ \item{n}{An \code{unsigned int} that dictates how many realizations occur.} \item{seeds}{A \code{vec} containing two integers greater than 0.} } \value{ A \code{matrix} with random sequences. } \description{ Shows how to create two separate RNGs and increase them together. } \examples{ n = 10 a = sitmo_two_seeds(n, c(1337, 1338)) b = sitmo_two_seeds(n, c(1337, 1337)) isTRUE(all.equal(a[,1], a[,2])) isTRUE(all.equal(b[,1], b[,2])) isTRUE(all.equal(a[,1], b[,1])) } sitmo/man/runif_r.Rd0000644000176200001440000000131713204107660014114 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{runif_r} \alias{runif_r} \title{Random Uniform Number Generator using base R} \usage{ runif_r(n, min = 0, max = 1) } \arguments{ \item{n}{An \code{unsigned integer} denoting the number of realizations to generate.} \item{min}{A \code{double} indicating the minimum \eqn{a} value in the uniform's interval \eqn{\left[a,b\right]}} \item{max}{A \code{double} indicating the maximum \eqn{b} value in the uniform's interval \eqn{\left[a,b\right]}} } \description{ The function provides an alternative implementation of random uniform distribution sampling using R's rng scope. } \examples{ set.seed(134) b = runif_r(10) } sitmo/man/sitmo_parallel.Rd0000644000176200001440000000226513204107660015462 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{sitmo_parallel} \alias{sitmo_parallel} \title{Test Generation using sitmo and C++11} \usage{ sitmo_parallel(n, seeds) } \arguments{ \item{n}{An \code{unsigned integer} denoting the number of realizations to generate.} \item{seeds}{A \code{vec} containing a list of seeds. Each seed is run on its own core.} } \value{ A \code{vec} containing the realizations. } \description{ The function provides an implementation of creating realizations from the default engine. } \details{ The following function's true power is only accessible on platforms that support OpenMP (e.g. Windows and Linux). However, it does provide a very good example as to how to make ones code applicable across multiple platforms. With this being said, how we determine how many cores to split the generation to is governed by the number of seeds supplied. In the event that one is using OS X, only the first seed supplied is used. } \examples{ a = sitmo_parallel(10, c(1)) b = sitmo_parallel(10, c(1,2)) c = sitmo_parallel(10, c(1,2)) # True on only OS X or systems without openmp isTRUE(all.equal(a,b)) isTRUE(all.equal(b,c)) } sitmo/LICENSE0000644000176200001440000000007712672355617012434 0ustar liggesusersYEAR: 2016 COPYRIGHT HOLDER: Thijs van den Berg, James Balamuta