Random number generation

Torbjorn Granlund tege at swox.com
Thu Nov 3 14:52:07 CET 2005

Décio Luiz Gazzoni Filho <decio at decpp.net> writes:

  I know I shouldn't try to help, but I will anyway.

Naughty you!

  ..., or perhaps read your CPU's cycle counter ...

I'd like to mildy warn against that particular seeding source.
The cycle counter typically is reset when a process is initiated,
and while it might yield slightly different values for subsequent
runs, it will typically only give a handful different values.

The current time is a better entropy source, except that it is
not useful for cryptographic purposes.

  ... obtaining a seed, you can use the functions from  here:
  http://www.swox.com/gmp/manual/Random-State-Seeding.html to  seed
  the pseudo-random number generator.

You're almost as rude as me, suggesting that people read the fine
manual!  :-)


More information about the gmp-discuss mailing list