Skip to content

MSWS

Abstract Scheme of the MSWS

Scalar

namespace pxart {

struct msws;

}

Include Scheme

#include <pxart/msws.hpp>

Member Types

using uint_type = uint64_t;
using result_type = uint32_t;

Member Functions

Construction and Seeding

constexpr msws();
Default constructor.


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

Generation

constexpr result_type 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 result_type min() noexcept;
static constexpr result_type max() noexcept;
Return the output range of pseudorandom numbers.

Example

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

using namespace std;

int main() {
  // Properly initialize pxart PRNG.
  pxart::msws 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