c961f78f03
Simplify the mess of random number generation. Also, even if rtlgenrandom is officially documented as don't use, if it gets changed/removed, if this emulator works is the least of your worries (Microsoft just broke all backward compatibility).
24 lines
547 B
C++
24 lines
547 B
C++
#ifndef _library__random__hpp__included__
|
|
#define _library__random__hpp__included__
|
|
|
|
#include <cstdlib>
|
|
|
|
namespace crandom
|
|
{
|
|
/**
|
|
* Initialize random number generator.
|
|
*
|
|
* Throws std::runtime_error: Can't initialize RNG.
|
|
*/
|
|
void init();
|
|
/**
|
|
* Generate random bits. Automatically initializes the generator if not already initialized.
|
|
*
|
|
* Parameter buffer: The buffer to fill.
|
|
* Parameter buffersize: Number of bytes to fill.
|
|
* Throws std::runtime_error: Can't initialize RNG.
|
|
*/
|
|
void generate(void* buffer, size_t buffersize);
|
|
}
|
|
|
|
#endif
|