How to generate Random N bit hex numbers?
asydney at k-state.edu
Mon Apr 19 16:38:08 CEST 2010
I am rather new to the GMP. With this said, I am attempting to generate a random N bit (where N can be any integer ex. 1024) hexadecimal number using the c++ interface. Below is a simple test where I generate a random '6' bit number in decimal.
gmp_randclass r (gmp_randinit_lc_2exp_size, 32);
z=r.get_z_bits(6); //z stores value of random integer.
However, I have not been able to find a function to do this similar process and produce hexadecimal random number.
If this is not possible, how would I go about converting an mpz_class integer to hexadecimal? For example if
how would I then convert z to hexadecimal?
More information about the gmp-discuss