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
Abstract class of GF(2)-linear pseudo random number generators.
This class is an Abstract class for calculating dimension of equi-distribution for GF(2)-linear pseud...