Closed qxzkjp closed 6 years ago
This seems useful. Is there any chance you could document it and add a test function.
Of course, I should be able to do that by the end of the week.
I've added a test and some documentation with a simple example.
I was a bit unsure of how to test this, but I settled on creating two gmp_randclass
es, and seeding one with it's seed
method, and one by calling get_randstate_t
and feeding it into gmp_randseed_ui
, then checking if they return the same stream of random numbers. This should ensure that the thing returned from get_randstate_t
is the real underlying state.
Thanks for this contribution!
We have
mpz_class::get_mpz_t
,mpf_class::get_mpf_t
, etc. which enable us to use those wrapper classes with C API functions that have no OO equivalent, without having to sacrifice memory safety. I have added an analogous method togmp_randclass
, to enable me to use it withmpz_likely_prime_p
, and I thought that this might be a modification that is generally useful.