Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca-rng.H File Reference

Reproducible random-number support for stochastic CA rules (Phase 8). More...

#include <cstddef>
#include <cstdint>
#include <random>
#include <type_traits>
#include <ca-traits.H>
Include dependency graph for ca-rng.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Aleph::CA::Per_Thread_RNG< Engine >
 Master seed dispenser for stochastic CA rules. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 

Functions

constexpr std::uint64_t Aleph::CA::splitmix64 (std::uint64_t x) noexcept
 64-bit SplitMix hash.
 
constexpr std::uint64_t Aleph::CA::mix_seed (const std::uint64_t a, const std::uint64_t b) noexcept
 Combine two 64-bit values into a single deterministic hash.
 
template<std::size_t Rank>
constexpr std::uint64_t Aleph::CA::cell_key_from_coord (const Coord_Vec< Rank > &c) noexcept
 Hash a cell coordinate into a stable 64-bit key.
 
template<std::size_t Rank>
constexpr std::uint64_t Aleph::CA::cell_seed (const std::uint64_t master_seed, const std::size_t step, const Coord_Vec< Rank > &coord) noexcept
 Build a deterministic per-cell seed.
 
template<std::size_t Rank>
constexpr std::uint64_t Aleph::CA::cell_seed (const std::uint64_t master_seed, const Cell_Context< Rank > &ctx) noexcept
 Build a deterministic per-cell seed from a Cell_Context.
 
constexpr std::uint64_t Aleph::CA::thread_step_seed (const std::uint64_t master_seed, const std::size_t thread_id, const std::size_t step) noexcept
 Build a deterministic seed from (master, thread_id, step).
 
template<typename Engine >
double Aleph::CA::uniform_unit (Engine &eng)
 Map a 64-bit RNG output to a uniform value in [0, 1).
 
template<typename Engine >
std::size_t Aleph::CA::uniform_int (Engine &eng, const std::size_t lo, const std::size_t hi)
 Sample a uniform integer in [lo, hi] (inclusive).
 

Detailed Description

Reproducible random-number support for stochastic CA rules (Phase 8).

Provides:

  • splitmix64 / mix_seed — stateless 64-bit hashing primitives.
  • cell_key_from_coord<Rank>(coord) — deterministic 64-bit hash of a cell coordinate.
  • cell_seed(master, step, coord) — deterministic per-cell seed derived from (master_seed, step, coord). Same (master, step, coord) triple → same seed regardless of thread scheduling, partition layout or visiting order.
  • Per_Thread_RNG<Engine> — thin wrapper around a master seed that builds fresh PRNG instances on demand from (step, coord) or (thread_id, step) triples.
  • uniform_unit(eng) / uniform_int(eng, lo, hi) — small, portable distribution helpers that bypass std::uniform_real_distribution (whose bit pattern is implementation-defined and therefore unsuitable for bit-exact reproducibility across compilers).

All helpers live in Aleph::CA and are header-only.

Author
Leandro Rabindranath Leon

Definition in file ca-rng.H.