c++ create random number till 10**120

I would like to get a random number in c++ between a and b where b can be also be 10^120+ and a is positiv. I found the GMP library but no good documentation withe examples where I can help my self to create such a number.

The Functions I (think) have to use is mpz_urandomm (mpz_t rop, gmp_randstate_t state, const mpz_t n) (or do I have to use mpz_urandomb) and that I have to define the seed (on the best way) withe /dev/random. I already defined a function to get these random binary numbers.

But from now on, I a bit lost :/

I'm happy about every useful answer.

best wishes Knut



Read more here: https://stackoverflow.com/questions/64944990/c-create-random-number-till-10120

Content Attribution

This content was originally published by L.knaeble at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: