1 #ifndef MTTOOLBOX_TEST_LINEARITY_HPP
2 #define MTTOOLBOX_TEST_LINEARITY_HPP
80 template<
typename U,
typename V = U>
102 g1->
seed(convert<U>(1234U));
103 g2->
seed(convert<U>(4321U));
104 bool result = test1(*g1) && test2(*g1, *g2);
116 for (
int i = 0; i < 100; i++) {
125 cout <<
"test1 passed" << endl;
127 cout <<
"test1 failed" << endl;
133 bool test2(EquidistributionCalculatable<U, V>& g1,
134 EquidistributionCalculatable<U, V>& g2) {
136 EquidistributionCalculatable<U, V> *g3 = g2.clone();
139 for (
int i = 0; i < 100; i++) {
140 U res1 = g1.generate();
141 U res2 = g2.generate();
142 U res3 = g3->generate();
143 if (!((res1 ^ res2) == res3)) {
146 cout <<
"i,res1,res2,res3 = " << dec << i <<
","
147 << hex << res1 <<
","
148 << res2 <<
"," << res3 <<
","
149 << (res1 ^ res2) << endl;
157 cout <<
"test2 passed" << endl;
159 cout <<
"test2 failed" << endl;
167 #endif // MTTOOLBOX_TEST_LINEARITY_HPP
このクラスはGF(2)線形疑似乱数生成器の均等分布次元を計算するためのクラスである。