Xoshiro256** PRNG (pseudo-random numbers generator).
More...
#include <tsXoshiro256ss.h>
|
| Xoshiro256ss ()=default |
| Constructor.
|
|
virtual UString | name () const override |
| Algorithm name (informational only).
|
|
virtual bool | read (void *, size_t) override |
| Get random data.
|
|
uint64_t | read64 () |
| Fast non-virtual generation of 64-bit random (not part of RandomGenerator interface).
|
|
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.
|
|
void | reset () |
| Return to initial state, not seeded.
|
|
virtual bool | seed (const void *, size_t) override |
| Seed (add entropy) to the PRNG.
|
|
|
static constexpr size_t | MIN_SEED_SIZE = 32 |
| Minimal initial accumulated seed size.
|
|
Xoshiro256** PRNG (pseudo-random numbers generator).
- See also
- https://en.wikipedia.org/wiki/Xorshift
◆ 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] | addr | Address of entropy data. |
[in] | size | Size 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] | addr | Address of returned random data. |
[in] | size | Requested 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] | data | Returned random data. |
[in] | size | Requested size in bytes of random data. |
- Returns
- True on success, false on error.
◆ readInt()
template<typename INT_T , typename std::enable_if< std::is_integral< INT_T >::value >::type * >
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_T | An integer type for the result. |
- Parameters
-
[out] | value | The return integer value. |
[in] | min | Minimum value to return. |
[in] | max | Maximum value to return. |
- Returns
- True on success, false on error.
The documentation for this class was generated from the following file: