TSDuck Version 3.15-964 (TSDuck - The MPEG Transport Stream Toolkit)
ts::SystemRandomGenerator Class Reference

System-provided PRNG (pseudo-random numbers generator). More...

Inheritance diagram for ts::SystemRandomGenerator:
Collaboration diagram for ts::SystemRandomGenerator:

Public Member Functions

 SystemRandomGenerator ()
 Constructor.
 
virtual ~SystemRandomGenerator ()
 Virtual destructor.
 
virtual UString name () const override
 Algorithm name (informational only). More...
 
virtual bool read (void *, size_t) override
 Get random data. More...
 
virtual bool readByteBlock (ByteBlock &data, size_t size)
 Get random data in a byte block. More...
 
virtual bool ready () const override
 Check if the PRNG is ready. More...
 
virtual bool seed (const void *, size_t) override
 Seed (add entropy) to the PRNG. More...
 

Detailed Description

System-provided PRNG (pseudo-random numbers generator).

Usually not the best PRNG on earth, but fine for most usages.

Member Function Documentation

◆ name()

virtual UString ts::SystemRandomGenerator::name ( ) const
inlineoverridevirtual

Algorithm name (informational only).

Returns
The algorithm name.

Implements ts::RandomGenerator.

Reimplemented in ts::BetterSystemRandomGenerator.

◆ seed()

virtual bool ts::SystemRandomGenerator::seed ( const void *  addr,
size_t  size 
)
overridevirtual

Seed (add entropy) to the PRNG.

Parameters
[in]addrAddress of entropy data.
[in]sizeSize in bytes of entropy data.
Returns
True on success, false on error.

Implements ts::RandomGenerator.

◆ ready()

virtual bool ts::SystemRandomGenerator::ready ( ) const
overridevirtual

Check if the PRNG is ready.

If not ready, it must be seeded again.

Returns
True if the PRNG is ready.

Implements ts::RandomGenerator.

Reimplemented in ts::BetterSystemRandomGenerator.

◆ read()

virtual bool ts::SystemRandomGenerator::read ( void *  addr,
size_t  size 
)
overridevirtual

Get random data.

Parameters
[out]addrAddress of returned random data.
[in]sizeRequested size in bytes of random data. The method always fill the buffer.
Returns
True on success, false on error.

Implements ts::RandomGenerator.

Reimplemented in ts::BetterSystemRandomGenerator.

◆ readByteBlock()

virtual bool ts::RandomGenerator::readByteBlock ( ByteBlock data,
size_t  size 
)
virtualinherited

Get random data in a byte block.

The default implementation uses read().

Parameters
[out]dataReturned random data.
[in]sizeRequested size in bytes of random data.
Returns
True on success, false on error.

The documentation for this class was generated from the following file: