I have a C++ program that uses /dev/urandom on Unix systems to seed
boost::mt19937. I'm porting the program to Windows. I can get good, random
seed data on Windows similar to random seed data produced from /dev/urandom
on Unix systems like so:
HCRYPTPROV hProvider = 0;
BYTE randomBytes[8];
CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
CryptGenRandom(hProvider, sizeof(randomBytes), randomBytes);
CryptReleaseContext(hProvider, 0);
However, I'm running into trouble attempting to pass these randomBytes to
boost::mt19937. On Unix I do something similar to this:
uint64_t GetSeed()
{
uint64_t seed;
std::ifstream urandom;
urandom.open("/dev/urandom");
urandom.read(reinterpret_cast