(Answer) (Category) Crypto++ Faq-O-Matic :
How do I use a random number generator?
Moderator: weidai (inherited from parent)
If you're running on a Win32 OS, or a Unix OS with /dev/random, then you can use AutoSeededRandomPool:
   #include "osrng.h"
   using namespace CryptoPP;
   AutoSeededRandomPool rng;
   byte randomBytes[10];
   rng.GenerateBlock(randomBytes, 10);
Otherwise you should use RandomPool and seed it yourself with random, unpredictable data:
   RandomPool rng;
   rng.Put(seed, seedLen);
   byte randomBytes[10];
   rng.GenerateBlock(randomBytes, 10);

2002-Dec-30 1:57pm weidai
[Append to This Answer]
2002-Dec-30 1:57pm
Previous: (Answer) How do I use a message authentication code?
Next: (Answer) How do I use a public key cryptosystem or signature scheme?
This document is: http://www.cryptopp.com/cgi-bin/fom.cgi?file=83
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.721.
This FAQ is administered by Wei Dai.