samedi 21 novembre 2020

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




Aucun commentaire:

Enregistrer un commentaire