CNum 0.2.1
CPU-optimized ML library for C++
Loading...
Searching...
No Matches
CNum::Utils::Rand::RandomGenerator Class Reference

A global service for random number generation. More...

#include <RandUtils.h>

Static Public Member Functions

static XoshiroCpp::Xoshiro256PlusPlus & instance (uint64_t logical_id=0)
 Get the instance of the RandomGenerator.
static void set_global_seed (uint64_t new_seed)
 Set the seed for random number generation.
static void reset_state ()
 Reconstruct all thread local random generators.

Detailed Description

A global service for random number generation.

The RandomGenerator class uses stateful logical-id based RNG streams. In order to ensure determinism, with this version of CNum's RNG implementation 2 threads cannot share an RNG associated with a logical id but can have their own RNGs associated with unique logical ids

Member Function Documentation

◆ instance()

XoshiroCpp::Xoshiro256PlusPlus & CNum::Utils::Rand::RandomGenerator::instance ( uint64_t logical_id = 0)
static

Get the instance of the RandomGenerator.

◆ reset_state()

void CNum::Utils::Rand::RandomGenerator::reset_state ( )
static

Reconstruct all thread local random generators.

◆ set_global_seed()

void CNum::Utils::Rand::RandomGenerator::set_global_seed ( uint64_t new_seed)
static

Set the seed for random number generation.

Parameters
seedThe new seed

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