Mini GMP Random generation.

Vincent Diepeveen diep at xs4all.nl
Thu Jul 20 16:07:40 UTC 2017


Where do you need GMP for if you just need 2048 bits random?
Just watch out if you fill the limbs with a RNG that you do not get 
multi-linear relationships, which you typically would get when using a 32 
bits RNG.

Use a 64 bits one and overlap it at random with another one at a few 
fields. Especially at multicore machines a lot of things are total random.

Plenty of RNG's to cut'n paste from the net that are pretty ok there.

Note that i did run into trouble one day there when using 32 bits unsigned 
integer numbers from a good RNG when i used those to make 64 bits random 
numbers which then were used in turn in a Zobrist Hashing algorithm.

Kind Regards,
Vincent

On Thu, 20 Jul 2017, Eduardo Sorribas wrote:

> Hey everybody!
>
> I'm using mini-gmp for a toy project, and I wanted to generate a large
> 2048 bit random number, but I realized the subset of functions
> included in mini-gmp doesn't include the random generation functions.
> I wrote a function that just generates a bunch of random numbers,
> concatenates them on a string, and then passes it to mini-gmp, but
> this seems kind of wrong to me, and is definitely not the most
> performant solution.
>
> Any ideas of an algorithm to  generate random n-bit numbers with
> mini-gmp? Thanks very much in advance.
>
> Eduardo Sorribas.
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list