Skip to content

Xoroshiro128+

Abstract Scheme of the Xoroshiro128+

Scalar

namespace pxart {

struct xoroshiro128plus;

using xrsr128p = xoroshiro128plus;

}

Include Scheme

#include <pxart/xoroshiro128plus.hpp>

Member Types

using uint_type = uint64_t;
using result_type = uint_type;

Member Functions

Construction and Seeding

xoroshiro128plus();
Default constructor.


xoroshiro128plus(uint_type x, uint_type y);
Parameter constructor.


template <typename RNG>
constexpr explicit xoroshiro128plus(RNG&& rng);
Initialize the PRNG by any other seeder or RNG.

Generation

constexpr auto operator()() noexcept;
Generate next pseudorandom number and advance inner state of the PRNG.


constexpr void jump() noexcept;
Advance the inner state by \(2^{64}\) elements.


constexpr void long_jump() noexcept;
Advance the inner state by \(2^{96}\) elements.

Characteristics

static constexpr auto min() noexcept;
static constexpr auto max() noexcept;
Return the output range of pseudorandom numbers.

Example

#include <iomanip>
#include <iostream>
#include <random>
//
#include <pxart/uniform.hpp>
#include <pxart/xoroshiro128plus.hpp>

using namespace std;

int main() {
  // Properly initialize pxart PRNG.
  pxart::xrsr128p rng{std::random_device{}};
  // Print some uniformly distributed random numbers.
  for (size_t i = 0; i < 10; ++i)
    cout << setw(20) << pxart::uniform<float>(rng) << '\n';
}

Last update: January 18, 2021