TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
System-provided PRNG (pseudo-random numbers generator). More...
#include <tsSystemRandomGenerator.h>
Public Member Functions | |
SystemRandomGenerator () | |
Constructor. | |
virtual | ~SystemRandomGenerator () override |
Virtual destructor. | |
virtual UString | name () const override |
Algorithm name (informational only). | |
virtual bool | read (void *, size_t) override |
Get random data. | |
virtual bool | readByteBlock (ByteBlock &data, size_t size) |
Get random data in a byte block. | |
template<typename INT_T , typename std::enable_if< std::is_integral< INT_T >::value >::type * = nullptr> | |
bool | readInt (INT_T &value, INT_T min=std::numeric_limits< INT_T >::min(), INT_T max=std::numeric_limits< INT_T >::max()) |
Get a random integer value inside a defined range. | |
virtual bool | ready () const override |
Check if the PRNG is ready. | |
virtual bool | seed (const void *, size_t) override |
Seed (add entropy) to the PRNG. | |
System-provided PRNG (pseudo-random numbers generator).
Usually not the best PRNG on earth, but fine for most usages.
|
overridevirtual |
Algorithm name (informational only).
Implements ts::RandomGenerator.
Reimplemented in ts::BetterSystemRandomGenerator.
|
overridevirtual |
Seed (add entropy) to the PRNG.
[in] | addr | Address of entropy data. |
[in] | size | Size in bytes of entropy data. |
Implements ts::RandomGenerator.
|
overridevirtual |
Check if the PRNG is ready.
If not ready, it must be seeded again.
Implements ts::RandomGenerator.
Reimplemented in ts::BetterSystemRandomGenerator.
|
overridevirtual |
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. |
Implements ts::RandomGenerator.
Reimplemented in ts::BetterSystemRandomGenerator.
|
virtualinherited |
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. |
|
inherited |
Get a random integer value inside a defined range.
INT_T | An integer type for the result. |
[out] | value | The return integer value. |
[in] | min | Minimum value to return. |
[in] | max | Maximum value to return. |