C(++)ECCO
C++ Error Control COding: a header-only library for ECC simulations and experiments, modeling complete coding systems across arbitrary finite fields and complex inter-field relationships - Christian Senger <senger@inue.uni-stuttgart.de>
Loading...
Searching...
No Matches
CECCO::RNG Class Reference

Thread-local random number generator with shared seeding policy. More...

#include <helpers.hpp>

Static Public Member Functions

static std::mt19937 & get ()
 Get thread-local random number generator.
static void seed (uint32_t seed)
 Set deterministic seed for all threads.
static void use_hardware_seed ()
 Enable hardware-based random seeding.

Detailed Description

Thread-local random number generator with shared seeding policy.

Provides one std::mt19937 engine per thread. seed() selects deterministic seeding; use_hardware_seed() returns to seeding from std::random_device. A seed change is observed on the next call to get in each thread.

Note
Use the static interface; the class has no object state.

Definition at line 56 of file helpers.hpp.

Member Function Documentation

◆ get()

std::mt19937 & CECCO::RNG::get ( )
inlinestatic

Get thread-local random number generator.

Returns
Reference to thread-local std::mt19937 generator

Initializes the engine on first access. If the global seed generation changed since the previous access in this thread, reseeds before returning.

Definition at line 65 of file helpers.hpp.

Here is the caller graph for this function:

◆ seed()

void CECCO::RNG::seed ( uint32_t seed)
inlinestatic

Set deterministic seed for all threads.

Parameters
seedBase seed value (combined with thread ID)

Selects deterministic seeding. Each thread uses seed XOR its thread ID hash.

Definition at line 77 of file helpers.hpp.

◆ use_hardware_seed()

void CECCO::RNG::use_hardware_seed ( )
inlinestatic

Enable hardware-based random seeding.

Selects seeding from std::random_device.

Definition at line 88 of file helpers.hpp.


The documentation for this class was generated from the following file: