CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
xoroshiro.h File Reference

Pseudo random number generator based on Xoroshiro algorithm. More...

#include <cstdint>
#include <cstdlib>
#include <debug.hh>
#include <initializer_list>

Go to the source code of this file.

Classes

class  ds::xoroshiro::detail::XorOshiro< State, Result, A, B, C, Jump0, Jump1, LongJump0, LongJump1 >
 The xoroshiro+ (not ++) generator(s) of Blackman and Vigna's Scrambled Linear Pseudorandom Number Generators (https://arxiv.org/abs/1805.01407, Figure 1). More...

Typedefs

using ds::xoroshiro::detail::Debug = ConditionalDebug<false, "xoroshiro">
using ds::xoroshiro::P128R64
 xoroshiro128+ with 64-bit output using the 2018 parameters.
using ds::xoroshiro::P128R32 = detail::XorOshiro<uint64_t, uint32_t, 24, 16, 37>
 xoroshiro128+ with 32-bit output using the 2018 parameters.
using ds::xoroshiro::P64R32 = detail::XorOshiro<uint32_t, uint32_t, 27, 7, 20>
 A "xoroshiro64+" with 32-bit outputs.
using ds::xoroshiro::P64R16 = detail::XorOshiro<uint32_t, uint16_t, 27, 7, 20>
 A "xoroshiro64+" with 16-bit outputs.
using ds::xoroshiro::P32R16 = detail::XorOshiro<uint16_t, uint16_t, 13, 5, 10>
 A "xoroshiro32+" with 16-bit outputs.
using ds::xoroshiro::P32R8 = detail::XorOshiro<uint16_t, uint8_t, 13, 5, 10>
 A "xoroshiro32+" with 16-bit outputs.
using ds::xoroshiro::P16R8 = detail::XorOshiro<uint8_t, uint8_t, 4, 7, 3>
 A "xoroshiro16+" with 8-bit outputs.

Detailed Description

Pseudo random number generator based on Xoroshiro algorithm.

Rather than using this directly you should probably use an implementation of the IsEntropySource concept so that different entropy sources may be substituted.

Definition in file xoroshiro.h.

Typedef Documentation

◆ Debug

using ds::xoroshiro::detail::Debug = ConditionalDebug<false, "xoroshiro">

Definition at line 25 of file xoroshiro.h.

◆ P128R32

using ds::xoroshiro::P128R32 = detail::XorOshiro<uint64_t, uint32_t, 24, 16, 37>

xoroshiro128+ with 32-bit output using the 2018 parameters.

Parameters as per P128R64, above.

Definition at line 173 of file xoroshiro.h.

◆ P128R64

Initial value:
uint64_t,
24,
16,
37,
0xdf900294d8f554a5,
0x170865df4b3201fc,
0xd2a98b26625eee7b,
0xdddf9b1090aa7ac1>
The xoroshiro+ (not ++) generator(s) of Blackman and Vigna's Scrambled Linear Pseudorandom Number Gen...
Definition xoroshiro.h:46

xoroshiro128+ with 64-bit output using the 2018 parameters.

Parameters (including jump parameters) from: https://prng.di.unimi.it/xoroshiro128plus.c

Definition at line 158 of file xoroshiro.h.

◆ P16R8

using ds::xoroshiro::P16R8 = detail::XorOshiro<uint8_t, uint8_t, 4, 7, 3>

A "xoroshiro16+" with 8-bit outputs.

As per Sebastino Vigna himself, writing in https://groups.google.com/g/prng/c/MWJjq11zRis/m/7nM_cwRzAQAJ , the parameters are one of may full-period triples, but "There are no good 16-bit generators".

Definition at line 215 of file xoroshiro.h.

◆ P32R16

using ds::xoroshiro::P32R16 = detail::XorOshiro<uint16_t, uint16_t, 13, 5, 10>

A "xoroshiro32+" with 16-bit outputs.

Parameters as per the Parallax Propeller 2 PRNG (discarding the "++" variant's fourth parameter "R"). See https://forums.parallax.com/discussion/comment/1448894 .

Definition at line 198 of file xoroshiro.h.

◆ P32R8

using ds::xoroshiro::P32R8 = detail::XorOshiro<uint16_t, uint8_t, 13, 5, 10>

A "xoroshiro32+" with 16-bit outputs.

Parameters as per P32R16, above.

Definition at line 205 of file xoroshiro.h.

◆ P64R16

using ds::xoroshiro::P64R16 = detail::XorOshiro<uint32_t, uint16_t, 27, 7, 20>

A "xoroshiro64+" with 16-bit outputs.

Parameters as per P64R32, above.

Definition at line 189 of file xoroshiro.h.

◆ P64R32

using ds::xoroshiro::P64R32 = detail::XorOshiro<uint32_t, uint32_t, 27, 7, 20>

A "xoroshiro64+" with 32-bit outputs.

As per Sebastino Vigna himself, writing in https://groups.google.com/g/prng/c/Ll-KDIbpO8k/m/bfHK4FlUCwAJ, these parameters are one of may full-period triples.

Definition at line 182 of file xoroshiro.h.