[PATCH] Custom random number generation function.
gmpdevel at formauri.es
Sat Aug 28 16:14:24 CEST 2010
Laurent Fousse wrote:
> I implemented a custom random number generation function. This lets
> you define a callback function to fill a buffer with random bytes,
> that will in turn be used by the actual generation functions like
> mpz_urandomb. A typical use-case is just reading bytes from
> /dev/urandom, if your system is nice enough to provide such a service.
Your proposed interface looks unacceptable to me. It serves only the
purpose of stateless generators like the use case you mention, but fails
to provide a general purpose interface that allows seedable generators.
Ideally, a custom RNG function should serve to expose the internal
random number generation infrastructure to the user, so that the user
can provide custom seeding, generation, clearing and state copying
Since those functions will be exposed to the user, they should also be
properly documented in this respect. Your proposed single
byte-buffer-filling function is too specific and does not provide a true
general custom random number generation interface.
-- Pedro Gimeno
More information about the gmp-devel