]> www.ginac.de Git - ginac.git/blobdiff - check/exam_cra.cpp
[bugfix] integer_cra: check if arguments contain at least 2 moduli
[ginac.git] / check / exam_cra.cpp
index 2c6163eef65c9e410e13bc8fa776bf4d0d96d3c5..6e247704fac4e9a82ed6d9e2716771e8c0de63dd 100644 (file)
@@ -102,12 +102,14 @@ make_random_moduli(const cln::cl_I& limit)
        std::vector<cln::cl_I> moduli;
        cln::cl_I prod(1);
        cln::cl_I next = random_I(std::min(limit >> 1, cln::cl_I(128)));
+       unsigned count = 0;
        do {
                cln::cl_I tmp = nextprobprime(next);
                next = tmp + random_I(cln::cl_I(10)) + 1;
                prod = prod*tmp;
                moduli.push_back(tmp);
-       } while (prod < limit);
+               ++count;
+       } while (prod < limit || (count < 2));
        return moduli;
 }