TSDuck v3.46-4965
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::Xoshiro256ss Class Reference

#include <tsXoshiro256ss.h>

Inheritance diagram for ts::Xoshiro256ss:
Collaboration diagram for ts::Xoshiro256ss:

Public Member Functions

 Xoshiro256ss ()=default
virtual UString name () const override
virtual bool read (void *, size_t) override
uint64_t read64 ()
virtual bool readByteBlock (ByteBlock &data, size_t size)
template<typename INT_T>
requires std::integral<INT_T>
bool readInt (INT_T &value, INT_T min=std::numeric_limits< INT_T >::min(), INT_T max=std::numeric_limits< INT_T >::max())
virtual bool ready () const override
void reset ()
virtual bool seed (const void *, size_t) override

Static Public Attributes

static constexpr size_t MIN_SEED_SIZE = 32

Detailed Description

Xoshiro256** PRNG (pseudo-random numbers generator).

See also
https://en.wikipedia.org/wiki/Xorshift

Constructor & Destructor Documentation

◆ Xoshiro256ss()

ts::Xoshiro256ss::Xoshiro256ss ( )
default

Constructor.

Member Function Documentation

◆ reset()

void ts::Xoshiro256ss::reset ( )

Return to initial state, not seeded.

◆ read64()

uint64_t ts::Xoshiro256ss::read64 ( )

Fast non-virtual generation of 64-bit random (not part of RandomGenerator interface).

Returns
64-bit random value.

◆ name()

virtual UString ts::Xoshiro256ss::name ( ) const
overridevirtual

Algorithm name (informational only).

Returns
The algorithm name.

Implements ts::RandomGenerator.

◆ seed()

virtual bool ts::Xoshiro256ss::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::Xoshiro256ss::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.

◆ read()

virtual bool ts::Xoshiro256ss::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.

◆ 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.

◆ readInt()

template<typename INT_T>
requires std::integral<INT_T>
bool ts::RandomGenerator::readInt ( INT_T & value,
INT_T min = std::numeric_limits<INT_T>::min(),
INT_T max = std::numeric_limits<INT_T>::max() )
inherited

Get a random integer value inside a defined range.

Template Parameters
INT_TAn integer type for the result.
Parameters
[out]valueThe return integer value.
[in]minMinimum value to return.
[in]maxMaximum value to return.
Returns
True on success, false on error.

Member Data Documentation

◆ MIN_SEED_SIZE

size_t ts::Xoshiro256ss::MIN_SEED_SIZE = 32
staticconstexpr

Minimal initial accumulated seed size.


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