Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
clustering::math::pcg64 Struct Reference

128-bit state for the PCG-XSL-RR 64-bit output generator (Melissa O'Neill). More...

#include <clustering/math/rng.h>

Public Member Functions

void seed (std::uint64_t seedValue, std::uint64_t stream=0) noexcept
 Initialize the generator per PCG's canonical seeding procedure.

Public Attributes

__uint128_t m_state = 0
 128-bit generator state; advanced by every advanceState call.
__uint128_t m_inc = 0
 Stream-encoded odd increment mixed into the LCG step.

Detailed Description

128-bit state for the PCG-XSL-RR 64-bit output generator (Melissa O'Neill).

State and stream are held as __uint128_t. Seed with seed(seed, stream); advance via the free function advanceState(rng). Reproducibility is load-bearing: the multiplier and output function match pcg-cpp's pcg64 so identical seed + stream produce identical u64 streams across platforms that have __uint128_t.

Definition at line 30 of file rng.h.

Member Function Documentation

◆ seed()

void clustering::math::pcg64::seed ( std::uint64_t seedValue,
std::uint64_t stream = 0 )
inlinenoexcept

Initialize the generator per PCG's canonical seeding procedure.

Matches Melissa O'Neill's pcg_basic reference: zero the state, set inc to (stream << 1) | 1, advance once, add the user seed, advance once more.

Parameters
seedValueUser-supplied seed mixed into the state after the stream selector.
streamStream identifier; two generators with identical seed but different streams produce uncorrelated output sequences.

Definition at line 46 of file rng.h.

Member Data Documentation

◆ m_inc

__uint128_t clustering::math::pcg64::m_inc = 0

Stream-encoded odd increment mixed into the LCG step.

Definition at line 34 of file rng.h.

◆ m_state

__uint128_t clustering::math::pcg64::m_state = 0

128-bit generator state; advanced by every advanceState call.

Definition at line 32 of file rng.h.


The documentation for this struct was generated from the following file:
  • include/clustering/math/rng.h