vendredi 19 juin 2015

C++ GMP Generating Random Number

I'm trying to generate a huge random number in C++ using the GMP library but am having issues figuring out the syntax. This is slightly different from other examples I've found because I need to set a floor and ceiling for the random number to be between. This is kinda what I need to do:

mpz_class high, low;

low  = pow(2,199);
high = pow(2,210);

// code to use the high and low numbers to generate the random number

I know this isn't much to go on, but again, I'm not sure what the syntax would even be at this point, I've tried several things but nothing I've found enables me to tell GMP to use a high and low range for the number generation.

Thoughts? Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire