# Class Xoroshiro256plus¶

## Class Documentation¶

class Xoroshiro256plus

A random number generator using the xoroshiro.

Note
From the authors of the algorthim: This is xoshiro256+ 1.0, our best and fastest generator for floating-point numbers. We suggest to use its upper bits for floating-point generation, as it is slightly faster than xoshiro256**. It passes all tests we are aware of except for the lowest three bits, which might fail linearity tests (and just those), so if low linear complexity is not considered an issue (as it is usually the case) it can be used to generate 64-bit outputs, too. We suggest to use a sign test to extract a random Boolean value, and right shifts to extract subsets of bits. The state must be seeded so that it is not everywhere zero. If you have a 64-bit seed, we suggest to seed a splitmix64 generator and use its output to fill the shuffle table.

Subclassed by random_numbers::RNGController

Public Functions

Xoroshiro256plus()
virtual ~Xoroshiro256plus()
Xoroshiro256plus(uint64_t seed)

Explicit constructor which sets the rng seed.

Parameters
• seed: the random seed

virtual void setSeed(uint64_t seed)
uint64_t next()

Generates the next random integer.

Return
a random integer from 0 to max of 2^64

double d01()

Generates a random number in the range [0, 1)

Return
a random double

void jump()

Jumps the generator forwards by the equivalent of 2^128 calls of next() - useful for parallel computations where different random number sequences are required.

Protected Attributes

std::array<uint64_t, 4> shuffle_table

Friends

std::ostream &operator<<(std::ostream &os, const Xoroshiro256plus &x)

Writes the random number generator to an output stream.

Return
Parameters
• os: the output stream to write to
• x: the random number generator to save

std::istream &operator>>(std::istream &is, Xoroshiro256plus &x)

Inputs the NRrand object from the input stream. Used for reading the NRrand object from a file.

Return
the input stream.
Parameters
• is: the input stream.
• r: the NRrand object to input to.