Abstract base class for PRNG's (pseudo-random numbers generators). More...
Public Member Functions | |
virtual | ~RandomGenerator () |
Virtual destructor. | |
virtual UString | name () const =0 |
Algorithm name (informational only). More... | |
virtual bool | read (void *addr, size_t size)=0 |
Get random data. More... | |
virtual bool | readByteBlock (ByteBlock &data, size_t size) |
Get random data in a byte block. More... | |
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr> | |
bool | readInt (INT &value) |
Get a random integer value. More... | |
virtual bool | ready () const =0 |
Check if the PRNG is ready. More... | |
virtual bool | seed (const void *addr, size_t size)=0 |
Seed (add entropy) to the PRNG. More... | |
Abstract base class for PRNG's (pseudo-random numbers generators).
|
pure virtual |
Algorithm name (informational only).
Implemented in ts::SystemRandomGenerator, and ts::BetterSystemRandomGenerator.
|
pure virtual |
Seed (add entropy) to the PRNG.
[in] | addr | Address of entropy data. |
[in] | size | Size in bytes of entropy data. |
Implemented in ts::SystemRandomGenerator.
|
pure virtual |
Check if the PRNG is ready.
If not ready, it must be seeded again.
Implemented in ts::SystemRandomGenerator, and ts::BetterSystemRandomGenerator.
|
pure virtual |
Get random data.
[out] | addr | Address of returned random data. |
[in] | size | Requested size in bytes of random data. The method always fill the buffer. |
Implemented in ts::SystemRandomGenerator, and ts::BetterSystemRandomGenerator.
|
virtual |
Get random data in a byte block.
The default implementation uses read().
[out] | data | Returned random data. |
[in] | size | Requested size in bytes of random data. |
|
inline |
Get a random integer value.
INT | An integer type for the result. |
[out] | value | The return integer value. |