This code look simply and in my opinion in clean than java version.
We can say it's equivalent in complexity.
The performance look very different.
Razii, please stop trolling comp.lang.c++.
uninteresting, and a waste of time.
Bye.
In article <n1o6u31aj5eu6al5f7uqk0hqlrv5jlfnct@4ax.com>,
DONTwhatevere3e@hotmail.com says...
[ ... ]
Exactly. There is no network, no threads, no bignum. No GUI. Nothing
really. And by the way, bignum is important. You can't do cryptology
without bignum.
Yes, you can do cryptology without bignum. In fact, you can do it quite
nicely. There are a few symmetric ciphers that use big numbers, but
bignums only come into heavy use for public-key ciphers.
In any case, the fact that something isn't in the standard library
hardly means that it doesn't exist.
Anyway, if you have GMP bignum library, can you post the c++ version
of java that I posted?
I haven't used GMP much, but with the library I normally use (NTL) it
would look something like this:
#include <NTL/zz.h>
#include <fstream>
#include <time.h>
#include <iostream>
int main() {
int bits = 1000;
std::ofstream out("prime.txt");
clock_t start = clock();
for (int i=0; i<10; i++)
out << NTL::RandomPrime_ZZ(bits) << "\n\n";
clock_t end = clock();
std::cout << "Time to generate ten "
<< bits
<< " bit prime numbers: "
<< float(end-start)/CLOCKS_PER_SEC
<< " Seconds\n";
return 0;
}
The result on my machine:
Time to generate ten 1000 bit prime numbers: 5.906 Seconds
...
Later,
Jerry.
The universe is a figment of its own imagination.